linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Zi Yan <zi.yan@cs.rutgers.edu>, Michal Hocko <mhocko@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 3/5] mm: Use alloc_flags to record if kswapd can wake
Date: Mon, 26 Nov 2018 14:38:07 +0100	[thread overview]
Message-ID: <39711f99-1a2a-67d3-5cb0-a63ac739a917@suse.cz> (raw)
In-Reply-To: <20181123114528.28802-4-mgorman@techsingularity.net>

On 11/23/18 12:45 PM, Mel Gorman wrote:
> This is a preparation patch that copies the GFP flag __GFP_KSWAPD_RECLAIM
> into alloc_flags. This is a preparation patch only that avoids having to
> pass gfp_mask through a long callchain in a future patch.
> 
> Note that the setting in the fast path happens in alloc_flags_nofragment()
> and it may be claimed that this has nothing to do with ALLOC_NO_FRAGMENT.
> That's true in this patch but is not true later so it's done now for
> easier review to show where the flag needs to be recorded.
> 
> No functional change.
> 
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

Small bug below:

> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3278,10 +3278,15 @@ static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
>   * fragmentation between the Normal and DMA32 zones.
>   */
>  static inline unsigned int
> -alloc_flags_nofragment(struct zone *zone)
> +alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
>  {
> +	unsigned int alloc_flags = 0;
> +
> +	if (gfp_mask & __GFP_KSWAPD_RECLAIM)
> +		alloc_flags |= ALLOC_KSWAPD;
> +
>  	if (zone_idx(zone) != ZONE_NORMAL)
> -		return 0;
> +		goto out;
>  
>  	/*
>  	 * If ZONE_DMA32 exists, assume it is the one after ZONE_NORMAL and
> @@ -3290,13 +3295,14 @@ alloc_flags_nofragment(struct zone *zone)
>  	 */
>  	BUILD_BUG_ON(ZONE_NORMAL - ZONE_DMA32 != 1);
>  	if (nr_online_nodes > 1 && !populated_zone(--zone))
> -		return 0;
> +		goto out;
>  
> -	return ALLOC_NOFRAGMENT;
> +out:
> +	return alloc_flags;
>  }
>  #else
>  static inline unsigned int
> -alloc_flags_nofragment(struct zone *zone)
> +alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
>  {
>  	return 0;

The !CONFIG_ZONE_DMA32 version should still set ALLOC_KSWAPD, right?

>  }
> @@ -3939,6 +3945,9 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
>  	} else if (unlikely(rt_task(current)) && !in_interrupt())
>  		alloc_flags |= ALLOC_HARDER;
>  
> +	if (gfp_mask & __GFP_KSWAPD_RECLAIM)
> +		alloc_flags |= ALLOC_KSWAPD;
> +
>  #ifdef CONFIG_CMA
>  	if (gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
>  		alloc_flags |= ALLOC_CMA;

  reply	other threads:[~2018-11-26 13:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 11:45 [PATCH 0/5] Fragmentation avoidance improvements v5 Mel Gorman
2018-11-23 11:45 ` [PATCH 1/5] mm, page_alloc: Spread allocations across zones before introducing fragmentation Mel Gorman
2018-11-26 12:36   ` Vlastimil Babka
2018-11-23 11:45 ` [PATCH 2/5] mm: Move zone watermark accesses behind an accessor Mel Gorman
2018-11-23 11:45 ` [PATCH 3/5] mm: Use alloc_flags to record if kswapd can wake Mel Gorman
2018-11-26 13:38   ` Vlastimil Babka [this message]
2018-11-26 14:35     ` [PATCH] mm: Use alloc_flags to record if kswapd can wake -fix Mel Gorman
2018-11-23 11:45 ` [PATCH 4/5] mm: Reclaim small amounts of memory when an external fragmentation event occurs Mel Gorman
2018-11-27  9:23   ` Vlastimil Babka
2018-11-23 11:45 ` [PATCH 5/5] mm: Stall movable allocations until kswapd progresses during serious external fragmentation event Mel Gorman
2018-11-27 13:20   ` Vlastimil Babka
2018-11-27 17:51     ` Mel Gorman
2018-12-05  8:06     ` Mel Gorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39711f99-1a2a-67d3-5cb0-a63ac739a917@suse.cz \
    --to=vbabka@suse.cz \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=zi.yan@cs.rutgers.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).