linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Sukadev Bhattiprolu <quic_sukadev@quicinc.com>
Cc: Minchan Kim <minchan@kernel.org>,
	Chris Goldsworthy <quic_cgoldswo@quicinc.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@surriel.com>, Roman Gushchin <guro@fb.com>,
	Vlastimil Babka <vbabka@suse.cz>, Joonsoo Kim <js1304@gmail.com>,
	Georgi Djakov <quic_c_gdjako@quicinc.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm,page_alloc,cma: configurable CMA utilization
Date: Mon, 8 Jan 2024 18:59:27 -0800	[thread overview]
Message-ID: <ZZy2j0vxkfQfiEK-@P9FQF9L96D> (raw)
In-Reply-To: <ca270573-5527-6df0-3fed-17e8c54b4f89@quicinc.com>

On Mon, Jan 08, 2024 at 12:15:05PM -0800, Sukadev Bhattiprolu wrote:
> 
> On 1/5/2024 4:05 PM, Roman Gushchin wrote:
> > I'm not sure there is a "one size fits all" solution here. 
> agree - that's why we are thinking a configurable cma utilization would be
> useful.
> > 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
> Could you please elaborate on this - how would we use the per-cma flags
> when allocating pages?

I mean potentially we can add some per-cma area configuration options which will
define the "priority" of using the memory from this cma area.

> > 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.
> 
> Stepping back, we are trying to solve for a situation where system:
>         - has lot of movable allocs in zone normal
>         - has lot of idle memory in CMA region
>         - but is low on memory for unmovable allocs, leading to oom-kills
> 
> On devices where cma region is mostly idle, allocating movable pages from
> the cma region would have lesser overhead?

It's not that easy: imagine booting up a small system with a cma area reserved
for some hardware-related operations. This is pretty much what cma was initially
designed. How to not fill the cma area up with the page cache?

Thanks!


      reply	other threads:[~2024-01-09  2:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  7:10 Sukadev Bhattiprolu
2023-01-31  7:23 ` Anshuman Khandual
2023-01-31 14:26 ` Georgi Djakov
2023-01-31 18:10 ` Roman Gushchin
2023-01-31 20:10   ` Sukadev Bhattiprolu
2023-01-31 23:59     ` Roman Gushchin
2023-02-01  4:06       ` Chris Goldsworthy
2023-02-01 19:00         ` Roman Gushchin
2023-02-02 20:13           ` Sukadev Bhattiprolu
2023-02-04  0:04             ` Roman Gushchin
2023-02-01 23:47         ` Minchan Kim
2023-02-06  5:22           ` Chris Goldsworthy
2023-02-08 22:00             ` Minchan Kim
2024-01-05 23:46           ` Sukadev Bhattiprolu
2024-01-06  0:05             ` Roman Gushchin
2024-01-08 20:15               ` Sukadev Bhattiprolu
2024-01-09  2:59                 ` Roman Gushchin [this message]

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=ZZy2j0vxkfQfiEK-@P9FQF9L96D \
    --to=roman.gushchin@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=quic_c_gdjako@quicinc.com \
    --cc=quic_cgoldswo@quicinc.com \
    --cc=quic_sukadev@quicinc.com \
    --cc=riel@surriel.com \
    --cc=vbabka@suse.cz \
    /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