[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231229114032.64d5320a97a7c776e10e8acf@linux-foundation.org>
Date: Fri, 29 Dec 2023 11:40:32 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Zhaoyang Huang <huangzhaoyang@...il.com>
Cc: Johannes Weiner <hannes@...xchg.org>, "zhaoyang.huang"
<zhaoyang.huang@...soc.com>, Roman Gushchin <roman.gushchin@...ux.dev>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, steve.kang@...soc.com,
Vlastimil Babka <vbabka@...e.cz>, Mel Gorman <mgorman@...hsingularity.net>,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCHv6 1/1] mm: optimization on page allocation when CMA
enabled
On Wed, 8 Nov 2023 16:55:19 +0800 Zhaoyang Huang <huangzhaoyang@...il.com> wrote:
> > > +static bool use_cma_first(struct zone *zone, unsigned int order, unsigned int alloc_flags)
> > > +{
> > > + unsigned long watermark;
> > > + bool cma_first = false;
> > > +
> > > + watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
> > > + /* check if GFP_MOVABLE pass previous zone_watermark_ok via the help of CMA */
> > > + if (zone_watermark_ok(zone, order, watermark, 0, alloc_flags & (~ALLOC_CMA))) {
> > > + /*
> > > + * Balance movable allocations between regular and CMA areas by
> > > + * allocating from CMA when over half of the zone's free memory
> > > + * is in the CMA area.
> > > + */
> ok, thanks for point out.
> Could we simple it like this, which will mis-judge kmalloc within
> ioctl as GFP_USER. I think it is ok as it is rare
> if (current_is_kswapd() || !current->mm)
> gfp_flags = GFP_KERNEL;
> else
> gfp_flags = GFP_USER;
> free_pages = zone_page_state(zone, NR_FREE_PAGES);
> free_pages -= zone->lowmem_reserve[gfp_zone(gfp_flags)];
> free_pages -= wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
> cma_first = free_pages > zone_page_state(zone, NR_FREE_PAGES) / 2);
>
This went all quiet. Do we feel that "mm: optimization on page
allocation when CMA enabled" should be merged as-is, or dropped in the
expectation that something based on Johannes's suggestion will be
developed?
Powered by blists - more mailing lists