]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: Move may_expand_vm() check in mmap_region()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 20 Jun 2024 02:06:06 +0000 (22:06 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 27 Aug 2024 16:49:10 +0000 (12:49 -0400)
commitbc093ef205202af9cb654024e7c4a7141864e09f
tree8a3be02f772ffd982e732a6da6f0c4d629f63213
parent63cde0cacc9b2775eb83e873d9fed9e3b13e829f
mm: Move may_expand_vm() check in mmap_region()

The may_expand_vm() check requires the count of the pages within the
munmap range.  Since this is needed for accounting and obtained later,
the reodering of ma_expand_vm() to later in the call stack, after the
vma munmap struct (vms) is initialised and the gather stage is
potentially run, will allow for a single loop over the vmas.  The gather
sage does not commit any work and so everything can be undone in the
case of a failure.

The MAP_FIXED page count is available after the vms_gather_munmap_vmas()
call, so use it instead of looping over the vmas twice.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
mm/mmap.c
mm/vma.c
mm/vma.h