[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YA8fKgFLuOi/rSez@google.com>
Date: Mon, 25 Jan 2021 11:42:34 -0800
From: Minchan Kim <minchan@...nel.org>
To: Michal Hocko <mhocko@...e.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>, hyesoo.yu@...sung.com,
david@...hat.com, surenb@...gle.com, pullip.cho@...sung.com,
joaodias@...gle.com, hridya@...gle.com, john.stultz@...aro.org,
sumit.semwal@...aro.org, linux-media@...r.kernel.org,
devicetree@...r.kernel.org, hch@...radead.org, robh+dt@...nel.org,
linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH v4 1/4] mm: cma: introduce gfp flag in cma_alloc instead
of no_warn
On Mon, Jan 25, 2021 at 02:07:01PM +0100, Michal Hocko wrote:
> On Thu 21-01-21 09:54:59, Minchan Kim wrote:
> > The upcoming patch will introduce __GFP_NORETRY semantic
> > in alloc_contig_range which is a failfast mode of the API.
> > Instead of adding a additional parameter for gfp, replace
> > no_warn with gfp flag.
> >
> > To keep old behaviors, it follows the rule below.
> >
> > no_warn gfp_flags
> >
> > false GFP_KERNEL
> > true GFP_KERNEL|__GFP_NOWARN
> > gfp & __GFP_NOWARN GFP_KERNEL | (gfp & __GFP_NOWARN)
> >
> > Reviewed-by: Suren Baghdasaryan <surenb@...gle.com>
> > Signed-off-by: Minchan Kim <minchan@...nel.org>
> [...]
> > diff --git a/mm/cma.c b/mm/cma.c
> > index 0ba69cd16aeb..d50627686fec 100644
> > --- a/mm/cma.c
> > +++ b/mm/cma.c
> > @@ -419,13 +419,13 @@ static inline void cma_debug_show_areas(struct cma *cma) { }
> > * @cma: Contiguous memory region for which the allocation is performed.
> > * @count: Requested number of pages.
> > * @align: Requested alignment of pages (in PAGE_SIZE order).
> > - * @no_warn: Avoid printing message about failed allocation
> > + * @gfp_mask: GFP mask to use during the cma allocation.
>
> Call out supported gfp flags explicitly. Have a look at kvmalloc_node
> for a guidance.
How about this?
diff --git a/mm/cma.c b/mm/cma.c
index d50627686fec..b94727b694d6 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -423,6 +423,10 @@ static inline void cma_debug_show_areas(struct cma *cma) { }
*
* This function allocates part of contiguous memory on specific
* contiguous memory area.
+ *
+ * For gfp_mask, GFP_KERNEL and __GFP_NORETRY are supported. __GFP_NORETRY
+ * will avoid costly functions(e.g., waiting on page_writeback and locking)
+ * at current implementaion during the page migration.
*/
struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
gfp_t gfp_mask)
Powered by blists - more mailing lists