mm/execmem.c | 61 +++++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 27 deletions(-)
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
Hi Hubert, On Tue, Mar 17, 2026 at 12:50:19PM +0000, Hubert Mazur wrote: > 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. typo: devices In general, a single patch does not require cover letter, but the details about why the patch is needed should be a part of the commit message. > 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 > -- Sincerely yours, Mike.
© 2016 - 2026 Red Hat, Inc.