linux/drivers
Aristeu Rozanski fa17bcd5f6 mm: make folio page count functions return unsigned
As raised by Andrew [1], a folio/compound page never spans a negative
number of pages.  Consequently, let's use "unsigned long" instead of
"long" consistently for folio_nr_pages(), folio_large_nr_pages() and
compound_nr().

Using "unsigned long" as return value is fine, because even
"(long)-folio_nr_pages()" will keep on working as expected.  Using
"unsigned int" instead would actually break these use cases.

This patch takes the first step changing these to return unsigned long
(and making drm_gem_get_pages() use the new types instead of replacing
min()).

In the future, we might want to make more callers of these functions to
consistently use "unsigned long".


Link: https://lore.kernel.org/linux-mm/20250503182858.5a02729fcffd6d4723afcfc2@linux-foundation.org/
Link: https://lkml.kernel.org/r/20250826153721.GA23292@cathedrallabs.org
Link: https://lore.kernel.org/linux-mm/20250503182858.5a02729fcffd6d4723afcfc2@linux-foundation.org/ [1]
Signed-off-by: Aristeu Rozanski <aris@ruivo.org>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: David Hildenbrand <david@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-09-21 14:22:31 -07:00
..
accel Merge drm/drm-fixes into drm-misc-fixes 2025-08-20 16:08:49 +02:00
accessibility
acpi Merge branches 'acpi-apei' and 'acpi-pfrut' 2025-08-21 20:47:23 +02:00
amba
android
ata ata: libata-sff: drop nth_page() usage within SG entry 2025-09-21 14:22:07 -07:00
atm atm: atmtcp: Prevent arbitrary write in atmtcp_recv_control(). 2025-08-22 17:23:15 -07:00
auxdisplay
base drivers/base/node: handle error properly in register_one_node() 2025-09-13 16:55:17 -07:00
bcma
block aoe: stop calling page_address() in free_page() 2025-09-21 14:22:17 -07:00
bluetooth Bluetooth: btnxpuart: Uses threaded IRQ for host wakeup handling 2025-08-15 10:13:26 -04:00
bus
cache
cdrom
cdx cdx: Fix off-by-one error in cdx_rpmsg_probe() 2025-08-19 12:55:16 +02:00
char /dev/zero: try to align PMD_SIZE for private mapping 2025-09-13 16:54:42 -07:00
clk
clocksource
comedi comedi: Make insn_rw_emulate_bits() do insn->n samples 2025-08-19 12:57:01 +02:00
connector
counter
cpufreq cpufreq: intel_pstate: Support Clearwater Forest OOB mode 2025-08-11 21:49:47 +02:00
cpuidle cpuidle: governors: menu: Avoid selecting states with too much latency 2025-08-18 19:04:25 +02:00
crypto
cxl
dax
dca
devfreq
dio
dma
dma-buf
dpll
edac
eisa
extcon
firewire
firmware efi: stmm: Drop unneeded null pointer check 2025-08-26 14:49:42 +02:00
fpga fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable() 2025-08-19 12:54:45 +02:00
fsi
fwctl
gnss
gpio gpio fixes for v6.17-rc4 2025-08-31 08:49:55 -07:00
gpu mm: make folio page count functions return unsigned 2025-09-21 14:22:31 -07:00
greybus
hid hid-for-linus-2025082901 2025-08-29 07:44:14 -07:00
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c i2c: rtl9300: Add missing count byte for SMBus Block Ops 2025-08-19 20:21:03 -01:00
i3c
idle intel_idle: Allow loading ACPI tables for any family 2025-08-11 21:43:26 +02:00
iio iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe() 2025-08-18 19:22:18 +01:00
infiniband RDMA/hns: Fix dip entries leak on devices newer than hip09 2025-08-13 07:22:18 -04:00
input
interconnect
iommu iommufd 6.17 first rc pull 2025-08-22 17:24:48 -04:00
ipack
irqchip irqchip/gic-v5: Remove undue WARN_ON()s in the IRS affinity parsing 2025-08-24 12:54:06 +02:00
isdn mISDN: hfcpci: Fix warning when deleting uninitialized timer 2025-08-25 17:15:01 -07:00
leds
macintosh
mailbox mailbox/pcc: support mailbox management of the shared buffer 2025-08-07 23:49:56 -05:00
mcb
md md: fix sync_action incorrect display during resync 2025-08-16 08:52:33 +08:00
media media: Remove redundant pm_runtime_mark_last_busy() calls 2025-08-18 09:55:08 +02:00
memory
memstick memstick: drop nth_page() usage within SG entry 2025-09-21 14:22:07 -07:00
message
mfd
misc treewide: remove MIGRATEPAGE_SUCCESS 2025-09-13 16:54:50 -07:00
mmc mmc: drop nth_page() usage within SG entry 2025-09-21 14:22:08 -07:00
most most: core: Drop device reference after usage in get_channel() 2025-08-19 12:57:34 +02:00
mtd
mux
net Including fixes from Bluetooth. 2025-08-28 17:35:51 -07:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of 17 hotfixes. 13 are cc:stable and the remainder address post-6.16 issues 2025-09-02 13:18:00 -07:00
opp
parisc
parport
pci PCI: vmd: Remove MSI-X check on child devices 2025-08-12 13:45:01 -05:00
pcmcia
peci
perf
phy
pinctrl pinctrl: airoha: Fix return value in pinconf callbacks 2025-08-22 15:08:58 +02:00
platform [GIT PULL for v6.17-rc4] media fixes 2025-08-27 10:10:50 -07:00
pmdomain
pnp
power
powercap
pps
ps3
ptp ptp: prevent possible ABBA deadlock in ptp_clock_freerun() 2025-08-12 14:17:35 -07:00
pwm
rapidio
ras
regulator regulator: pm8008: fix probe failure due to negative voltage selector 2025-08-24 22:41:04 +01:00
remoteproc
reset
rpmsg
rtc
s390 s390/sclp: Fix SCCB present check 2025-08-20 16:37:27 +02:00
sbus
scsi scsi: sg: drop nth_page() usage within SG entry 2025-09-21 14:22:08 -07:00
sh
siox
slimbus
soc Merge tag 'drm-msm-fixes-2025-08-26' of https://gitlab.freedesktop.org/drm/msm into drm-fixes 2025-08-29 09:05:18 +10:00
soundwire
spi spi: Fixes for v6.17 2025-08-21 16:28:00 -04:00
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES 2025-08-11 16:16:36 +02:00
ufs scsi: ufs: ufs-qcom: Fix ESI null pointer dereference 2025-08-18 22:25:52 -04:00
uio
usb usb: xhci: fix host not responding after suspend and resume 2025-08-19 16:12:13 +02:00
vdpa
vfio vfio/pci: drop nth_page() usage within SG entry 2025-09-21 14:22:08 -07:00
vhost vhost/net: Protect ubufs with rcu read lock in vhost_net_ubuf_put() 2025-08-26 03:38:10 -04:00
video gpio updates for v6.17-rc1 2025-08-09 08:15:43 +03:00
virt virt: sev-guest: Satisfy linear mapping requirement in get_derived_key() 2025-08-15 17:05:39 +02:00
virtio virtio_balloon: stop calling page_address() in free_pages() 2025-09-21 14:22:18 -07:00
w1
watchdog
xen mm: rename vm_ops->find_special_page() to vm_ops->find_normal_page() 2025-09-13 16:54:53 -07:00
zorro
Kconfig
Makefile