mirror-linux/drivers/gpu/drm
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
..
amd drm/amd/pm: Drop unsupported features on smu v14_0_2 2024-08-28 10:07:37 -04:00
arm Linux 6.10-rc6 2024-07-05 10:47:28 +02:00
armada
aspeed
ast drm/ast: astdp: Wake up during connector status detection 2024-07-30 10:17:14 +02:00
atmel-hlcdc drm: atmel-hlcdc: add LCD controller layer definition for sam9x75 2024-05-30 15:47:55 +02:00
bridge drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
ci drm/ci: add tests on vkms 2024-06-17 08:02:48 -03:00
display Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
etnaviv drm/etnaviv: don't block scheduler when GPU is still active 2024-06-26 15:33:25 +02:00
exynos Linux 6.10-rc6 2024-07-05 10:47:28 +02:00
fsl-dcu
gma500 drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
gud drm: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:44:39 +02:00
hisilicon drm/hisilicon/hibmc: convert to struct drm_edid 2024-05-27 15:31:18 +03:00
hyperv
i2c
i915 drm/i915/dp_mst: Fix MST state after a sink reset 2024-08-28 11:32:25 +03:00
imagination drm/imagination: Convert to platform remove callback returning void 2024-05-27 10:13:55 +02:00
imx drm/imx/ldb: convert to struct drm_edid 2024-05-27 17:25:49 +03:00
ingenic Merge drm/drm-next into drm-misc-next 2024-05-27 11:08:31 +02:00
kmb
lib
lima drm-misc-next for $kernel-version: 2024-07-05 12:37:22 +02:00
logicvc
loongson drm/loongson/7a2000: convert to struct drm_edid 2024-05-27 15:31:36 +03:00
mcde
mediatek drm/mediatek: Set sensible cursor width/height values to fix crash 2024-08-05 13:06:20 +00:00
meson drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
mgag200 drm/mgag200: Rename constant MGAREG_Status to MGAREG_STATUS 2024-07-03 17:55:29 +02:00
msm Merge tag 'drm-msm-fixes-2024-08-19' of https://gitlab.freedesktop.org/drm/msm into drm-fixes 2024-08-23 06:46:29 +10:00
mxsfb
nouveau Short summary of fixes pull: 2024-08-23 09:08:41 +10:00
omapdrm drm/omap: add CONFIG_MMU dependency 2024-08-05 15:54:29 +03:00
panel A fix for fbdev on big endian systems, a condition fix for a sharp panel 2024-07-12 12:50:30 +10:00
panfrost drm-misc-next for $kernel-version: 2024-07-05 12:37:22 +02:00
panthor drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
pl111
qxl drm/qxl: Pin buffer objects for internal mappings 2024-07-10 09:12:42 +02:00
radeon minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
renesas Linux 6.10-rc6 2024-07-05 10:47:28 +02:00
rockchip drm/rockchip: inno-hdmi: Fix infoframe upload 2024-08-15 12:31:47 +02:00
scheduler tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
solomon
sprd
sti drm/sti: Allow build with COMPILE_TEST=y 2024-05-28 21:43:46 +03:00
stm Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
sun4i drm/sun4i: Fix layer zpos change/atomic modesetting 2024-06-10 12:44:41 +02:00
tegra
tests drm/test: fix the gem shmem test to map the sg table. 2024-08-02 09:24:31 +02:00
tidss drm/tidss: Add drm_panic support 2024-06-18 10:06:35 +02:00
tilcdc
tiny drm/tiny: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:44:32 +02:00
ttm drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
tve200
udl drm: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:44:39 +02:00
v3d drm/v3d: Disable preemption while updating GPU stats 2024-08-28 11:36:53 -03:00
vboxvideo pci-v6.11-changes 2024-07-19 19:03:18 -07:00
vc4 drm/vc4: vec: Add the margin properties to the connector 2024-06-20 10:02:41 +02:00
vgem
virtio Merge drm/drm-fixes into drm-misc-fixes 2024-07-30 09:09:23 +02:00
vkms
vmwgfx drm/vmwgfx: Disable coherent dumb buffers without 3d 2024-08-26 00:19:44 -04:00
xe drm/xe/hwmon: Fix WRITE_I1 param from u32 to u16 2024-08-29 09:44:00 -04:00
xen
xlnx drm: zynqmp_dp: Don't delay work 2024-06-17 10:38:18 +03:00
Kconfig Merge drm/drm-fixes into drm-misc-fixes 2024-07-30 09:09:23 +02:00
Makefile
drm_aperture.c
drm_atomic.c Merge tag 'drm-intel-next-2024-06-28' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2024-07-10 10:36:47 +02:00
drm_atomic_helper.c
drm_atomic_state_helper.c
drm_atomic_uapi.c drm/atomic: allow no-op FB_ID updates for async flips 2024-08-06 20:16:31 +02:00
drm_auth.c
drm_blend.c
drm_bridge.c drm/bridge: Drop drm_bridge_chain_mode_fixup 2024-06-10 14:09:42 +02:00
drm_bridge_connector.c drm/bridge-connector: Fix double free in error handling paths 2024-08-05 17:39:14 +02:00
drm_buddy.c drm/buddy: Add start address support to trim function 2024-08-07 18:19:00 -04:00
drm_cache.c
drm_client.c drm/client: Fix error code in drm_client_buffer_vmap_local() 2024-07-29 08:50:23 +02:00
drm_client_modeset.c drm/client: fix null pointer dereference in drm_client_modeset_probe 2024-08-02 09:23:54 +02:00
drm_color_mgmt.c minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
drm_connector.c drm: Add DRM_MODE_TV_MODE_MONOCHROME 2024-06-18 11:13:30 +02:00
drm_crtc.c drm: Rename drm_plane_check_pixel_format() to drm_plane_has_format() 2024-06-24 17:08:33 +03:00
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h Merge tag 'drm-intel-next-2024-06-28' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2024-07-10 10:36:47 +02:00
drm_damage_helper.c
drm_debugfs.c drm/bridge-connector: implement glue code for HDMI connector 2024-06-12 10:56:57 +03:00
drm_debugfs_crc.c
drm_displayid.c
drm_displayid_internal.h
drm_drv.c
drm_dumb_buffers.c
drm_edid.c drm/edid: add a helper for EDID sysfs property show 2024-05-23 14:37:24 +03:00
drm_edid_load.c
drm_eld.c
drm_encoder.c
drm_encoder_slave.c
drm_exec.c mm: kvmalloc: align kvrealloc() with krealloc() 2024-09-01 20:25:44 -07:00
drm_fb_dma_helper.c
drm_fb_helper.c Merge drm/drm-fixes into drm-misc-fixes 2024-07-30 09:09:23 +02:00
drm_fbdev_dma.c A fix for fbdev on big endian systems, a condition fix for a sharp panel 2024-07-12 12:50:30 +10:00
drm_fbdev_shmem.c drm/fbdev-shmem: Clean up deferred I/O 2024-05-15 14:50:46 +02:00
drm_fbdev_ttm.c drm next for 6.11-rc1: 2024-07-18 09:34:02 -07:00
drm_file.c drm/drm_file: Fix pid refcounting race 2024-06-28 08:56:26 +10:00
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c
drm_framebuffer.c
drm_gem.c
drm_gem_atomic_helper.c
drm_gem_dma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c drm/gem-shmem: Add import attachment warning to locked pin function 2024-05-29 09:30:44 +02:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c
drm_gpuvm.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_kms_helper_common.c
drm_lease.c
drm_managed.c drm/managed: Simplify if condition 2024-07-03 10:11:03 +02:00
drm_mipi_dbi.c drm: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:44:39 +02:00
drm_mipi_dsi.c Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
drm_mm.c drm/mm: Remove unused drm_mm_replace_node 2024-06-06 10:24:13 -04:00
drm_mode_config.c
drm_mode_object.c drm/mode_object: Export drm_mode_obj_find_prop_id for tests 2024-05-28 09:57:28 +02:00
drm_modes.c drm: Add DRM_MODE_TV_MODE_MONOCHROME 2024-06-18 11:13:30 +02:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_panel.c
drm_panel_orientation_quirks.c drm: panel-orientation-quirks: Add quirk for Ayn Loki Max 2024-08-12 10:28:33 +02:00
drm_panic.c drm/panic: Restrict graphical logo handling to built-in 2024-06-27 11:41:58 +02:00
drm_pci.c
drm_plane.c drm: Export drm_plane_has_format() 2024-06-24 17:08:53 +03:00
drm_plane_helper.c
drm_prime.c
drm_print.c drm/print: Improve drm_dbg_printer 2024-06-06 14:46:15 -04:00
drm_privacy_screen.c
drm_privacy_screen_x86.c
drm_probe_helper.c drm: Add DRM_MODE_TV_MODE_MONOCHROME 2024-06-18 11:13:30 +02:00
drm_property.c
drm_rect.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:44:39 +02:00
drm_suballoc.c
drm_syncobj.c
drm_sysfs.c drm/edid: add a helper for EDID sysfs property show 2024-05-23 14:37:24 +03:00
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c drm: Add drm_vblank_work_flush_all(). 2024-06-24 18:03:18 +02:00
drm_vma_manager.c
drm_writeback.c