Re: [PATCH -mm] slab: fix cpuset check in fallback_alloc

From: David Rientjes
Date: Mon Aug 11 2014 - 17:05:25 EST


On Mon, 11 Aug 2014, Vladimir Davydov wrote:

> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1963,7 +1963,7 @@ zonelist_scan:
> >
> > /*
> > * Scan zonelist, looking for a zone with enough free.
> > - * See also __cpuset_node_allowed_softwall() comment in kernel/cpuset.c.
> > + * See __cpuset_node_allowed() comment in kernel/cpuset.c.
> > */
> > for_each_zone_zonelist_nodemask(zone, z, zonelist,
> > high_zoneidx, nodemask) {
> > @@ -1974,7 +1974,7 @@ zonelist_scan:
> > continue;
> > if (cpusets_enabled() &&
> > (alloc_flags & ALLOC_CPUSET) &&
> > - !cpuset_zone_allowed_softwall(zone, gfp_mask))
> > + !cpuset_zone_allowed(zone, gfp_mask))
> > continue;
>
> So, this is get_page_from_freelist. It's called from
> __alloc_pages_nodemask with alloc_flags always having ALLOC_CPUSET bit
> set and from __alloc_pages_slowpath with alloc_flags having ALLOC_CPUSET
> bit set only for __GFP_WAIT allocations. That said, w/o your patch we
> try to respect cpusets for all allocations, including atomic, and only
> ignore cpusets if tight on memory (freelist's empty) for !__GFP_WAIT
> allocations, while with your patch we always ignore cpusets for
> !__GFP_WAIT allocations. Not sure if it really matters though, because
> usually one uses cpuset.mems in conjunction with cpuset.cpus and it
> won't make any difference then. It also doesn't conflict with any cpuset
> documentation.
>

Yeah, that's why I'm asking Li, the cpuset maintainer, if we can do this.
The only thing that we get by falling back to the page allocator slowpath
is that kswapd gets woken up before the allocation is attempted without
ALLOC_CPUSET. It seems pointless to wakeup kswapd when the allocation can
succeed on any node. Even with the patch, if the allocation fails because
all nodes are below their min watermark, then we still fallback to the
slowpath and wake up kswapd but there's nothing much else we can do
because it's !__GFP_WAIT.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/