Re: realloc function
"Andi Kleen" <[email protected]> Mon, 3 Jan 2011 00:42:32 +0100
| Newsgroups | org.kernel.vger.linux-numa |
|---|---|
| Message-ID | <[email protected]> |
> I am submitting a patch for a realloc function that might be useful. The > proposed numa_realloc() is merely a wrapper to mremap(), which it calls > with the flag MREMAP_MAYMOVE. The policy of the vm area is copied by the > kernel in case of moving. I am also submitting a test program, that > keeps expanding an initial allocation until a limit is reached and > checks the mempolicy of the expanded area in every iteration. > > My use case is a dynamic array implementation which uses realloc() to > dynamically expand the array and I want to convert it to a numa-aware > implementation. You need to call numa_police_memory_int() in the function, otherwise the policy won't be actually preserved. -Andi