> > > This patch resets preferred_zone to an allowed zone in the slowpath if > > > the allocation context is constrained by current's cpuset. > > > > Well, preferred_zone has meaning. If it's not possible to allocate from > > that zone in the current cpuset context, it's not really preferred. Why > > not set it in the fast path so there isn't a useless call to > > get_page_from_freelist()? > > > > It may be the preferred zone even if it isn't allowed by current's cpuset > such as if the allocation is __GFP_WAIT or the task has been oom killed > and has the TIF_MEMDIE bit set, so the preferred zone in the fastpath is > accurate in these cases. In the slowpath, the former is protected by > checking for ALLOC_CPUSET and the latter is usually only set after the > page allocator has looped at least once and triggered the oom killer to be > killed. > > I didn't want to add a branch to test for these possibilities in the > fastpath, however, since preferred_zone isn't of critical importance until > it's used in the slowpath (ignoring the statistical usage). I'm glad to you are keeping fastpath concern. However you don't need nodemask-and in this case. Because zonelist->zref[0] is always in nodemask. Please see policy_zonelist(). So, you can just replace nodemask with cpuset_mems_allowed. This is not only simple, but also improve a consisteny of mempolicy. --- mm/page_alloc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 07a6544..876de04 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2146,7 +2146,8 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, get_mems_allowed(); /* The preferred zone is used for statistics later */ - first_zones_zonelist(zonelist, high_zoneidx, nodemask, &preferred_zone); + first_zones_zonelist(zonelist, high_zoneidx, + &cpuset_current_mems_allowed, &preferred_zone); if (!preferred_zone) { put_mems_allowed(); return NULL; -- 1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>