mmap-alloc: tweak a comment on ppc64
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 3 Dec 2015 08:35:31 +0000 (10:35 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 22 Dec 2015 15:45:12 +0000 (17:45 +0200)
The comment I put in mmap-alloc to document the ppc64 rules
refers to the previous revision of the patch:
we don't look at memory alignment anymore, we check
the fs from which the fd is mapped, instead.

It's also not clear what does "in this case" refer
to, rearrange text to make it clearer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
util/mmap-alloc.c

index 54793a5dcf8d79964bbcde25d7eb78eb0ce662e4..5cd7f71ac3425193941b3c6c32435a1d4337680c 100644 (file)
@@ -50,10 +50,11 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
 #if defined(__powerpc64__) && defined(__linux__)
     /* On ppc64 mappings in the same segment (aka slice) must share the same
      * page size. Since we will be re-allocating part of this segment
-     * from the supplied fd, we should make sure to use the same page size,
-     * unless we are using the system page size, in which case anonymous memory
-     * is OK. Use align as a hint for the page size.
-     * In this case, set MAP_NORESERVE to avoid allocating backing store memory.
+     * from the supplied fd, we should make sure to use the same page size, to
+     * this end we mmap the supplied fd.  In this case, set MAP_NORESERVE to
+     * avoid allocating backing store memory.
+     * We do this unless we are using the system page size, in which case
+     * anonymous memory is OK.
      */
     int anonfd = fd == -1 || qemu_fd_getpagesize(fd) == getpagesize() ? -1 : fd;
     int flags = anonfd == -1 ? MAP_ANONYMOUS : MAP_NORESERVE;