diff options
| author | Hugh Dickins <[email protected]> | 2023-10-12 04:40:09 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-10-18 21:34:14 +0000 |
| commit | 1431996bf9088ee59f8017637ab9a7f89909ae63 (patch) | |
| tree | 8b0533590f06ee436b37353695b35730eb7aa976 /mm/filemap.c | |
| parent | shmem,percpu_counter: add _limited_add(fbc, limit, amount) (diff) | |
| download | kernel-1431996bf9088ee59f8017637ab9a7f89909ae63.tar.gz kernel-1431996bf9088ee59f8017637ab9a7f89909ae63.zip | |
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/[email protected]
Signed-off-by: Hugh Dickins <[email protected]>
Cc: Axel Rasmussen <[email protected]>
Cc: Carlos Maiolino <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Chuck Lever <[email protected]>
Cc: Darrick J. Wong <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Tim Chen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/filemap.c')
0 files changed, 0 insertions, 0 deletions
