Re: [PATCH 1/4] mm, page_alloc: Split buffered_rmqueue

From: Mel Gorman
Date: Tue Jan 17 2017 - 16:07:56 EST


On Tue, Jan 17, 2017 at 08:20:08PM +0000, Mel Gorman wrote:
> It's late so I'm fairly tired but assuming I can reproduce this in the
> morning, the first thing I'll try is something like this to force a reread
> of mems_allowed;
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ebea51cc0135..3fc2b3a8d301 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3774,13 +3774,6 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
> .migratetype = gfpflags_to_migratetype(gfp_mask),
> };
>
> - if (cpusets_enabled()) {
> - alloc_mask |= __GFP_HARDWALL;
> - alloc_flags |= ALLOC_CPUSET;
> - if (!ac.nodemask)
> - ac.nodemask = &cpuset_current_mems_allowed;
> - }
> -
> gfp_mask &= gfp_allowed_mask;
>
> lockdep_trace_alloc(gfp_mask);
> @@ -3802,6 +3795,13 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
> alloc_flags |= ALLOC_CMA;
>
> retry_cpuset:
> + if (cpusets_enabled()) {
> + alloc_mask |= __GFP_HARDWALL;
> + alloc_flags |= ALLOC_CPUSET;
> + if (!nodemask)
> + ac.nodemask = &cpuset_current_mems_allowed;
> + }
> +
> cpuset_mems_cookie = read_mems_allowed_begin();
>
> /* Dirty zone balancing only done in the fast path */
>

I later recalled that we looked at this before and didn't think a reinit
was necessary because the location of cpuset_current_mems_allowed doesn't
change so I came back and took another look. The location doesn't change
but after the first attempt, we reset ac.nodemask to the given nodemask and
don't recheck current_mems_allowed if the cpuset changed. The application
of memory policies versus cpusets is a mess so it'll take time to pick
apart to see if this is even remotely in the right direction.

--
Mel Gorman
SUSE Labs