linux-stable/include
Hugh Dickins 1431996bf9 percpu_counter: extend _limited_add() to negative amounts
Though tmpfs does not need it, percpu_counter_limited_add() can be twice
as useful if it works sensibly with negative amounts (subs) - typically
decrements towards a limit of 0 or nearby: as suggested by Dave Chinner.

And in the course of that reworking, skip the percpu counter sum if it is
already obvious that the limit would be passed: as suggested by Tim Chen.

Extend the comment above __percpu_counter_limited_add(), defining the
behaviour with positive and negative amounts, allowing negative limits,
but not bothering about overflow beyond S64_MAX.

Link: https://lkml.kernel.org/r/8f86083b-c452-95d4-365b-f16a2e4ebcd4@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Tim Chen <tim.c.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-10-18 14:34:14 -07:00
..
acpi
asm-generic mm: add statistics for PUD level pagetable 2023-10-06 14:44:10 -07:00
clocksource
crypto
drm drm/tests: helpers: Avoid a driver uaf 2023-09-14 13:57:58 +02:00
dt-bindings IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
keys
kunit
kvm
linux percpu_counter: extend _limited_add() to negative amounts 2023-10-18 14:34:14 -07:00
math-emu
media media updates for v6.6-rc1 2023-09-01 12:21:32 -07:00
memory
misc
net netfilter: nf_tables: fix memleak when more than 255 elements expired 2023-09-20 10:35:23 +02:00
pcmcia
ras
rdma
rv rv: Set variable 'da_mon_##name' to static 2023-09-01 21:00:00 -04:00
scsi ATA fixes for 6.6-rc4 2023-09-29 13:38:34 -07:00
soc IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
sound ASoC: Name iov_iter argument as iterator instead of buffer 2023-09-01 15:38:49 +02:00
target
trace mm/damon/core: use nr_accesses_bp as a source of damos_before_apply tracepoint 2023-10-04 10:32:31 -07:00
uapi fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs 2023-10-18 14:34:12 -07:00
ufs Merge branch 'fixes' into misc 2023-09-02 08:25:19 +01:00
vdso
video
xen arm/xen: remove lazy mode related definitions 2023-09-19 07:04:49 +02:00