[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZZiZVnJpOpt1DAq1@P9FQF9L96D.corp.robot.car>
Date: Fri, 5 Jan 2024 16:05:42 -0800
From: Roman Gushchin <roman.gushchin@...ux.dev>
To: Sukadev Bhattiprolu <quic_sukadev@...cinc.com>
Cc: Minchan Kim <minchan@...nel.org>,
Chris Goldsworthy <quic_cgoldswo@...cinc.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Rik van Riel <riel@...riel.com>, Roman Gushchin <guro@...com>,
Vlastimil Babka <vbabka@...e.cz>, Joonsoo Kim <js1304@...il.com>,
Georgi Djakov <quic_c_gdjako@...cinc.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm,page_alloc,cma: configurable CMA utilization
On Fri, Jan 05, 2024 at 03:46:55PM -0800, Sukadev Bhattiprolu wrote:
>
> On 2/1/2023 3:47 PM, Minchan Kim wrote:
> >
> > I like this patch for different reason but for the specific problem you
> > mentioned, How about making reclaimer/compaction aware of the problem:
> >
> > IOW, when the GFP_KERNEL/DMA allocation happens but not enough memory
> > in the zones, let's migrates movable pages in those zones into CMA
> > area/movable zone if they are plenty of free memory.
>
> Hi Minchan,
>
> Coming back to this thread after a while.
>
> If the CMA region is usually free, allocating pages first in the non-CMA
> region and then moving them into the CMA region would be extra work since
> it would happen most of the time. In such cases, wouldn't it be better to
> allocate from the CMA region itself?
I'm not sure there is a "one size fits all" solution here. There are two
distinctive cases:
1) A relatively small cma area used for a specific purpose. This is how cma
was used until recently. And it was barely used by the kernel for non-cma
allocations.
2) A relatively large cma area which is used to allocate gigantic hugepages
and as an anti-fragmentation mechanism in general (basically as a movable
zone). In this case it might be preferable to use cma for movable
allocations, because the space for non-movable allocations might be limited.
I see two options here:
1) introduce per-cma area flags which will define the usage policy
2) redesign the page allocator to better take care of fragmentation at 1Gb scale
The latter is obviously not a small endeavour.
The fundamentally missing piece is a notion of an anti-fragmentation cost.
E.g. how much work does it makes sense to put into page migration
before "polluting" a new large block of memory with an unmovable folio.
Thanks!
Powered by blists - more mailing lists