public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Encapsulate the populate and alloc as one atomic
@ 2026-03-17 12:50 Hubert Mazur
  2026-03-17 12:50 ` [PATCH v2 1/1] mm/execmem: Make the populate and alloc atomic Hubert Mazur
  2026-03-18 14:30 ` [PATCH v2 0/1] Encapsulate the populate and alloc as one atomic Mike Rapoport
  0 siblings, 2 replies; 4+ messages in thread
From: Hubert Mazur @ 2026-03-17 12:50 UTC (permalink / raw)
  To: Andrew Morton, Mike Rapoport
  Cc: Greg Kroah-Hartman, Stanislaw Kardach, Michal Krawczyk,
	Slawomir Rosek, Lukasz Majczak, linux-mm, linux-kernel,
	Hubert Mazur

Hello,
thanks for the review of the v1 patchset. I tried to make v2 diff as
small as possible and without a modification of the core logic.

When a block of memory is requested from the execmem manager the
free_areas tree is traversed to find area of given size. If it is not
found then a new fragment, aligned to a PAGE_SIZE, is allocated and
added to free_areas. Afterwards, the free_areas tree is being traversed
again to fullfil the request.

The above operations of allocation and tree traversal are not atomic
hence another request may consume this newly allocated memory
block dedicated to the original request. As a result - the first
request fails to get the memory. Such occurence can be spotted on
evices running the 6.18 kernel during the paralell modules loading.

Regards
Hubert

Changes in v2:
The __execmem_cache_alloc_locked function (lockless version of
__execmem_cache_alloc) is introduced and called after
execmem_cache_add_locked from the __execmem_cache_populate_alloc
function (renamed from execmem_cache_populate). Both calls are
guarded now with a single mutex.

Changes in v1:
Allocate new memory fragment and assign it directly to the busy_areas
inside execmem_cache_populate function.

Link to v1:
https://lore.kernel.org/all/20260312131438.361746-1-hmazur@google.com/T/#t

Hubert Mazur (1):
  mm/execmem: Make the populate and alloc atomic

 mm/execmem.c | 61 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

--
2.53.0.851.ga537e3e6e9-goog



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

end of thread, other threads:[~2026-03-18 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 12:50 [PATCH v2 0/1] Encapsulate the populate and alloc as one atomic Hubert Mazur
2026-03-17 12:50 ` [PATCH v2 1/1] mm/execmem: Make the populate and alloc atomic Hubert Mazur
2026-03-18 14:41   ` Mike Rapoport
2026-03-18 14:30 ` [PATCH v2 0/1] Encapsulate the populate and alloc as one atomic Mike Rapoport

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