All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@lge.com, Vlastimil Babka <vbabka@suse.cz>,
	Christoph Hellwig <hch@infradead.org>,
	Roman Gushchin <guro@fb.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Michal Hocko <mhocko@suse.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: fix memalloc_nocma_{save/restore} APIs
Date: Tue, 21 Jul 2020 13:05:33 +0100	[thread overview]
Message-ID: <20200721120533.GD15516@casper.infradead.org> (raw)
In-Reply-To: <1595302129-23895-1-git-send-email-iamjoonsoo.kim@lge.com>

On Tue, Jul 21, 2020 at 12:28:49PM +0900, js1304@gmail.com wrote:
> +static inline unsigned int current_alloc_flags(gfp_t gfp_mask,
> +					unsigned int alloc_flags)
> +{
> +#ifdef CONFIG_CMA
> +	unsigned int pflags = current->flags;
> +
> +	if (!(pflags & PF_MEMALLOC_NOCMA) &&
> +		gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
> +		alloc_flags |= ALLOC_CMA;

Please don't indent by one tab when splitting a line because it looks like
the second line and third line are part of the same block.  Either do
this:

	if (!(pflags & PF_MEMALLOC_NOCMA) &&
	    gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
		alloc_flags |= ALLOC_CMA;

or this:
	if (!(pflags & PF_MEMALLOC_NOCMA) &&
			gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
		alloc_flags |= ALLOC_CMA;

> @@ -4619,8 +4631,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>  		wake_all_kswapds(order, gfp_mask, ac);
>  
>  	reserve_flags = __gfp_pfmemalloc_flags(gfp_mask);
> -	if (reserve_flags)
> +	if (reserve_flags) {
>  		alloc_flags = reserve_flags;
> +		alloc_flags = current_alloc_flags(gfp_mask, alloc_flags);
> +	}

Is this right?  Shouldn't you be passing reserve_flags to
current_alloc_flags() here?  Also, there's no need to add { } here.


  parent reply	other threads:[~2020-07-21 12:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21  3:28 [PATCH] mm/page_alloc: fix memalloc_nocma_{save/restore} APIs js1304
2020-07-21  9:17 ` Vlastimil Babka
2020-07-21 12:05 ` Matthew Wilcox [this message]
2020-07-21 12:38   ` Vlastimil Babka
2020-07-21 12:43     ` Matthew Wilcox
2020-07-23  1:42       ` Joonsoo Kim
2020-07-23  1:42         ` Joonsoo Kim
2020-07-23  1:38     ` Joonsoo Kim
2020-07-23  1:38       ` Joonsoo Kim

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=20200721120533.GD15516@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=guro@fb.com \
    --cc=hch@infradead.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.