linux/drivers/dax
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
..
hmem mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
bus.c driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
bus.h dax/kmem: allow kmem to add memory with memmap_on_memory 2023-12-10 16:51:35 -08:00
cxl.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
dax-private.h dax: Document struct dev_dax_range 2024-11-08 09:38:37 -07:00
device.c mm: consistently use current->mm in mm_get_unmapped_area() 2025-11-16 17:27:57 -08:00
Kconfig mm: make range-to-target_node lookup facility a part of numa_memblks 2024-09-03 21:15:32 -07:00
kmem.c mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
Makefile cxl/dax: Create dax devices for CXL RAM regions 2023-02-10 17:33:45 -08:00
pmem.c mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
super.c fs: rename generic_delete_inode() and generic_drop_inode() 2025-09-15 16:09:42 +02:00