linux/arch
Ryan Roberts 9ac09bb9fe mm: consistently use current->mm in mm_get_unmapped_area()
mm_get_unmapped_area() is a wrapper around arch_get_unmapped_area() /
arch_get_unmapped_area_topdown(), both of which search current->mm for
some free space.  Neither take an mm_struct - they implicitly operate on
current->mm.

But the wrapper takes an mm_struct and uses it to decide whether to search
bottom up or top down.  All callers pass in current->mm for this, so
everything is working consistently.  But it feels like an accident waiting
to happen; eventually someone will call that function with a different mm,
expecting to find free space in it, but what gets returned is free space
in the current mm.

So let's simplify by removing the parameter and have the wrapper use
current->mm to decide which end to start at.  Now everything is consistent
and self-documenting.

Link: https://lkml.kernel.org/r/20251003155306.2147572-1-ryan.roberts@arm.com
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-16 17:27:57 -08:00
..
alpha assorted dead code removal around asm/pgtable.h 2025-10-03 11:37:50 -07:00
arc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
arm hardening fixes for v6.18-rc5 2025-11-06 11:54:59 -08:00
arm64 mm/huge_memory: initialise the tags of the huge zero folio 2025-11-09 21:19:46 -08:00
csky csky: abiv2: adapt to new folio flags field 2025-10-21 15:46:18 -07:00
hexagon Remove long-stale ext3 defconfig option 2025-10-15 07:57:28 -07:00
loongarch rust: kbuild: support -Cjump-tables=n for Rust 1.93.0 2025-11-04 19:11:39 +01:00
m68k Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
microblaze Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
mips pci-v6.18-fixes-3 2025-10-24 16:43:08 -07:00
nios2 Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
openrisc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
parisc parisc: Avoid crash due to unaligned access in unwinder 2025-11-04 12:21:59 +01:00
powerpc mm: fix MAX_FOLIO_ORDER on powerpc configs with hugetlb 2025-11-15 10:52:00 -08:00
riscv riscv: KGDB: Replace deprecated strcpy in kgdb_arch_handle_qxfer_pkt 2025-10-27 23:30:01 -06:00
s390 s390 fixes for 6.18-rc4 2025-10-31 12:50:35 -07:00
sh Remove long-stale ext3 defconfig option 2025-10-15 07:57:28 -07:00
sparc mm: consistently use current->mm in mm_get_unmapped_area() 2025-11-16 17:27:57 -08:00
um updates for UML, notably 2025-10-06 12:10:55 -07:00
x86 mm: consistently use current->mm in mm_get_unmapped_area() 2025-11-16 17:27:57 -08:00
xtensa Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
.gitignore
Kconfig compiler_types: Introduce __nocfi_generic 2025-10-29 20:04:55 -07:00