Re: [PATCH 20/27] mm, vmscan: Update classzone_idx if buffer_heads_over_limit

From: Michal Hocko
Date: Wed Jun 22 2016 - 10:49:22 EST


On Tue 21-06-16 15:15:59, Mel Gorman wrote:
> If buffer heads are over the limit then the direct reclaim gfp_mask
> is promoted to __GFP_HIGHMEM so that lowmem is indirectly freed. With
> node-based reclaim, it is also required that the classzone_idx be updated
> or the pages will be skipped.
>
> Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> mm/vmscan.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1f7c1262c0a3..f4c759b3581b 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2571,8 +2571,10 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc,
> * highmem pages could be pinning lowmem pages storing buffer_heads
> */
> orig_mask = sc->gfp_mask;
> - if (buffer_heads_over_limit)
> + if (buffer_heads_over_limit) {
> sc->gfp_mask |= __GFP_HIGHMEM;
> + classzone_idx = gfp_zone(sc->gfp_mask);
> + }
>
> for_each_zone_zonelist_nodemask(zone, z, zonelist,
> gfp_zone(sc->gfp_mask), sc->nodemask) {

The code that follows that however does update classzone_idx
/*
* Note that reclaim_idx does not change as it is the highest
* zone reclaimed from which for empty zones is a no-op but
* classzone_idx is used by shrink_node to test if the slabs
* should be shrunk on a given node.
*/
while (!populated_zone(zone->zone_pgdat->node_zones +
classzone_idx)) {
classzone_idx--;
}

so if we start with a zone which doesn't have the highmem zone we will
not see highmems of other zone AFAIU. I guess this would be unlikely
because highmem systems will be UMA in most cases but the code looks a
bit confusing.

--
Michal Hocko
SUSE Labs