On Tue, Feb 25, 2014 at 06:09:20PM +0800, Hu Tao wrote: > On Wed, Feb 19, 2014 at 10:03:13AM +0100, Paolo Bonzini wrote: > > <...> > > > > static int > > > ram_backend_memory_init(HostMemoryBackend *backend, Error **errp) > > > { > > >+ HostMemoryBackendRam *ram_backend = MEMORY_BACKEND_RAM(backend); > > >+ int mode = ram_backend->policy; > > >+ void *p; > > >+ unsigned long maxnode; > > >+ > > > if (!memory_region_size(&backend->mr)) { > > > memory_region_init_ram(&backend->mr, OBJECT(backend), > > > object_get_canonical_path(OBJECT(backend)), > > > backend->size); > > >+ > > >+ p = memory_region_get_ram_ptr(&backend->mr); > > >+ maxnode = find_last_bit(ram_backend->host_nodes, MAX_NODES); > > >+ > > >+ mode |= ram_backend->relative ? MPOL_F_RELATIVE_NODES : > > >+ MPOL_F_STATIC_NODES; > > >+ /* This is a workaround for a long standing bug in Linux' > > >+ * mbind implementation, which cuts off the last specified > > >+ * node. To stay compatible should this bug be fixed, we > > >+ * specify one more node and zero this one out. > > >+ */ > > >+ if (syscall(SYS_mbind, p, backend->size, mode, > > >+ ram_backend->host_nodes, maxnode + 2, 0)) { > > > > This does not compile on non-Linux; also, does libnuma include the > > workaround? If so, this is a hint that we should be using libnuma > > instead... > > Tested with libnuma and works fine without the workaround. Will use > libnuma in v19.
Sorry I might do something wrong about the test. With libnuma the workaround is still needed. I checked numactl-2.0.9, it doesn't include the workaround.