Re: [PATCH 6/8] Add __GFP_OTHER_NODE flag

David Rientjes
2011-02-22T21:42:09Z

On Mon, 21 Feb 2011, Andi Kleen wrote:

> From: Andi Kleen <ak@linux.intel.com>
>
> Add a new __GFP_OTHER_NODE flag to tell the low level numa statistics
> in zone_statistics() that an allocation is on behalf of another thread.
> This way the local and remote counters can be still correct, even
> when background daemons like khugepaged are changing memory
> mappings.
>
> This only affects the accounting, but I think it's worth doing that
> right to avoid confusing users.
>

This makes the accounting worse, NUMA_LOCAL is defined as "allocation from
local node," meaning it's local to the allocating cpu, not local to the
node being targeted.

Further, preferred_zone has taken on a much more significant meaning other
than just statistics: it impacts the behavior of memory compaction and how
long congestion timeouts are, if a timeout is taken at all, depending on
the I/O being done on behalf of the zone.

A better way to address the issue is by making sure preferred_zone is
actually correct by using the appropriate zonelist to be passed into the
allocator in the first place.

> I first tried to just pass down the right node, but this required
> a lot of changes to pass down this parameter and at least one
> addition of a 10th argument to a 9 argument function. Using
> the flag is a lot less intrusive.
>

And adding a branch to every successful page allocation for statistics
isn't intrusive?