linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Matthew Wilcox <willy@infradead.org>, js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@lge.com, 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 14:38:56 +0200	[thread overview]
Message-ID: <4c484ce0-cfed-0c50-7a20-d1474ce9afee@suse.cz> (raw)
In-Reply-To: <20200721120533.GD15516@casper.infradead.org>

On 7/21/20 2:05 PM, Matthew Wilcox wrote:
> 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;

Ah, good point.

>> @@ -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.

Note the "alloc_flags = reserve_flags;" line is not being deleted here. But if
it was, your points would be true, and yeah it would be a bit more tidy.


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21  3:28 js1304
2020-07-21  9:17 ` Vlastimil Babka
2020-07-21 12:05 ` Matthew Wilcox
2020-07-21 12:38   ` Vlastimil Babka [this message]
2020-07-21 12:43     ` Matthew Wilcox
2020-07-23  1:42       ` 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=4c484ce0-cfed-0c50-7a20-d1474ce9afee@suse.cz \
    --to=vbabka@suse.cz \
    --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=willy@infradead.org \
    /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