[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200721120533.GD15516@casper.infradead.org>
Date: Tue, 21 Jul 2020 13:05:33 +0100
From: Matthew Wilcox <willy@...radead.org>
To: js1304@...il.com
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-team@....com,
Vlastimil Babka <vbabka@...e.cz>,
Christoph Hellwig <hch@...radead.org>,
Roman Gushchin <guro@...com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Michal Hocko <mhocko@...e.com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>, stable@...r.kernel.org
Subject: Re: [PATCH] mm/page_alloc: fix memalloc_nocma_{save/restore} APIs
On Tue, Jul 21, 2020 at 12:28:49PM +0900, js1304@...il.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.
Powered by blists - more mailing lists