linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [LSF/MM/BPF TOPIC] Guaranteed CMA
@ 2025-02-02  0:19 Suren Baghdasaryan
  2025-02-04  5:46 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Suren Baghdasaryan @ 2025-02-02  0:19 UTC (permalink / raw)
  To: lsf-pc
  Cc: SeongJae Park, Minchan Kim, m.szyprowski, aneesh.kumar,
	Joonsoo Kim, mina86, Matthew Wilcox, Vlastimil Babka,
	Lorenzo Stoakes, Liam R. Howlett, David Hildenbrand,
	Michal Hocko, linux-mm, android-kernel-team

Hi,
I would like to discuss the Guaranteed Contiguous Memory Allocator
(GCMA) mechanism that is being used by many Android vendors as an
out-of-tree feature, collect input on its possible usefulness for
others, feasibility to upstream and suggestions for possible better
alternatives.

Problem statement: Some workloads/hardware require physically
contiguous memory and carving out reserved memory areas for such
allocations often lead to inefficient usage of those carveouts. CMA
was designed to solve this inefficiency by allowing movable memory
allocations to use this reserved memory when it’s otherwise unused.
When a contiguous memory allocation is requested, CMA finds the
requested contiguous area, possibly migrating some of the movable
pages out of that area.
In latency-sensitive use cases, like face unlock on phones, we need to
allocate contiguous memory quickly and page migration in CMA takes
enough time to cause user-perceptible lag. Such allocations can also
fail if page migration is not possible.

GCMA (Guaranteed CMA) is a mechanism previously proposed in [1] which
was not upstreamed but got adopted later by many Android vendors as an
out-of-tree feature. It is similar to CMA but backing memory is
cleancache backend, containing only clean file-backed pages. Most
importantly, the kernel can’t take a reference to pages from the
cleancache, therefore can’t prevent GCMA from quickly dropping them
when required. This guarantees GCMA low allocation latency and
improves allocation success rate.

We would like to standardize GCMA implementation and upstream it since
many Android vendors are asking to include it as a generic feature.

Note: removal of cleancache in 5.17 kernel due to no users (sorry, we
didn’t know at the time about this use case) might complicate
upstreaming.

Desired participants:
GCMA authors: SeongJae Park <sj@kernel.org>, Minchan Kim <minchan@kernel.org>
CMA authors: Marek Szyprowski <m.szyprowski@samsung.com>, Aneesh Kumar
K.V <aneesh.kumar@kernel.org>, Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Michal Nazarewicz <mina86@mina86.com>
The usual suspects (Willy, Vlastimil, Lorenzo, Liam, Michal, David H),
other mm folks

[1] https://lore.kernel.org/lkml/1424721263-25314-2-git-send-email-sj38.park@gmail.com/


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-10-10 15:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-02  0:19 [LSF/MM/BPF TOPIC] Guaranteed CMA Suren Baghdasaryan
2025-02-04  5:46 ` Christoph Hellwig
2025-02-04  7:47   ` Lorenzo Stoakes
2025-02-04  7:48     ` Christoph Hellwig
2025-02-04  9:03   ` Vlastimil Babka
2025-02-04 15:56     ` Suren Baghdasaryan
2025-02-04  8:18 ` David Hildenbrand
2025-02-04 11:23   ` Alexandru Elisei
2025-02-04 16:33     ` Suren Baghdasaryan
2025-03-20 18:06       ` Suren Baghdasaryan
2025-04-02 16:35         ` Suren Baghdasaryan
2025-08-22 22:14           ` Suren Baghdasaryan
2025-08-26  8:58             ` David Hildenbrand
2025-08-27  0:17               ` Suren Baghdasaryan
2025-09-01 16:01                 ` David Hildenbrand
2025-10-10  1:30                   ` Suren Baghdasaryan
2025-10-10 13:58                     ` David Hildenbrand
2025-10-10 15:07                       ` Suren Baghdasaryan
2025-10-10 15:37                         ` David Hildenbrand
2025-10-10 15:47                           ` Suren Baghdasaryan
2025-02-04  9:07 ` Vlastimil Babka
2025-02-04 16:20   ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox