From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andi Kleen" Subject: Re: realloc function Date: Mon, 3 Jan 2011 00:42:32 +0100 Message-ID: References: <4D20B7E6.9020207@cslab.ece.ntua.gr> Mime-Version: 1.0 Content-Transfer-Encoding: 7BIT Return-path: In-Reply-To: <4D20B7E6.9020207@cslab.ece.ntua.gr> Sender: linux-numa-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Vasileios Karakasis Cc: linux-numa@vger.kernel.org, 'Kornilios Kourtis' > 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