linux/arch/powerpc/platforms
Danilo Krummrich 590b9d576c mm: kvmalloc: align kvrealloc() with krealloc()
Besides the obvious (and desired) difference between krealloc() and
kvrealloc(), there is some inconsistency in their function signatures and
behavior:

 - krealloc() frees the memory when the requested size is zero, whereas
   kvrealloc() simply returns a pointer to the existing allocation.

 - krealloc() behaves like kmalloc() if a NULL pointer is passed, whereas
   kvrealloc() does not accept a NULL pointer at all and, if passed,
   would fault instead.

 - krealloc() is self-contained, whereas kvrealloc() relies on the caller
   to provide the size of the previous allocation.

Inconsistent behavior throughout allocation APIs is error prone, hence
make kvrealloc() behave like krealloc(), which seems superior in all
mentioned aspects.

Besides that, implementing kvrealloc() by making use of krealloc() and
vrealloc() provides oppertunities to grow (and shrink) allocations more
efficiently.  For instance, vrealloc() can be optimized to allocate and
map additional pages to grow the allocation or unmap and free unused pages
to shrink the allocation.

[dakr@kernel.org: document concurrency restrictions]
  Link: https://lkml.kernel.org/r/20240725125442.4957-1-dakr@kernel.org
[dakr@kernel.org: disable KASAN when switching to vmalloc]
  Link: https://lkml.kernel.org/r/20240730185049.6244-2-dakr@kernel.org
[dakr@kernel.org: properly document __GFP_ZERO behavior]
  Link: https://lkml.kernel.org/r/20240730185049.6244-5-dakr@kernel.org
Link: https://lkml.kernel.org/r/20240722163111.4766-3-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Chandan Babu R <chandan.babu@oracle.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-09-01 20:25:44 -07:00
..
8xx powerpc: Untangle fixmap.h and pgtable.h and mmu.h 2023-10-19 17:12:44 +11:00
44x powerpc/platforms: Move files from 4xx to 44x 2024-06-28 22:28:48 +10:00
52xx powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX 2024-05-08 00:25:00 +10:00
82xx powerpc/82xx: Select FSL_SOC 2023-09-18 12:23:48 +10:00
83xx powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX 2024-05-08 00:25:00 +10:00
85xx powerpc: add missing MODULE_DESCRIPTION() macros 2024-07-04 22:39:20 +10:00
86xx powerpc/86xx: Drop unused CONFIG_MPC8610 2023-12-29 15:23:00 +11:00
512x powerpc: Fix typos 2024-05-08 00:21:30 +10:00
amigaone powerpc/amigaone: Make several functions static 2024-03-07 00:13:28 +11:00
book3s powerpc/vas: Limit open window failure messages in log bufffer 2023-10-20 17:10:03 +11:00
cell powerpc: add missing MODULE_DESCRIPTION() macros 2024-07-04 22:39:20 +10:00
chrp powerpc: add missing MODULE_DESCRIPTION() macros 2024-07-04 22:39:20 +10:00
embedded6xx powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc. 2024-03-07 00:13:28 +11:00
maple powerpc: Fix typos 2024-05-08 00:21:30 +10:00
microwatt
pasemi powerpc: Stop using of_root 2024-03-03 22:20:29 +11:00
powermac powerpc: Fix typos 2024-05-08 00:21:30 +10:00
powernv powerpc/iommu: Reimplement the iommu_table_group_ops for pSeries 2024-06-28 17:03:40 +10:00
ps3 driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
pseries mm: kvmalloc: align kvrealloc() with krealloc() 2024-09-01 20:25:44 -07:00
fsl_uli1575.c
Kconfig powerpc/40x: Remove 40x platforms. 2024-06-28 22:28:47 +10:00
Kconfig.cputype powerpc: Remove 40x leftovers 2024-07-12 11:43:41 +10:00
Makefile powerpc/platforms: Move files from 4xx to 44x 2024-06-28 22:28:48 +10:00