summaryrefslogtreecommitdiff
path: root/crypto/md4.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2022-10-25 01:18:41 -0700
committerJohn Johansen <john.johansen@canonical.com>2023-10-18 16:00:45 -0700
commitea9bae12d02819556db63348db8bd8441eb316f2 (patch)
tree8f2a31d41082be914673193fe991a4e8bee809cb /crypto/md4.c
parentc4371d90633b73cf6e86aff43ff2b5d95ad2b9eb (diff)
downloadlwn-ea9bae12d02819556db63348db8bd8441eb316f2.tar.gz
lwn-ea9bae12d02819556db63348db8bd8441eb316f2.zip
apparmor: cache buffers on percpu list if there is lock contention
commit df323337e507 ("apparmor: Use a memory pool instead per-CPU caches") changed buffer allocation to use a memory pool, however on a heavily loaded machine there can be lock contention on the global buffers lock. Add a percpu list to cache buffers on when lock contention is encountered. When allocating buffers attempt to use cached buffers first, before taking the global buffers lock. When freeing buffers try to put them back to the global list but if contention is encountered, put the buffer on the percpu list. The length of time a buffer is held on the percpu list is dynamically adjusted based on lock contention. The amount of hold time is increased and decreased linearly. v5: - simplify base patch by removing: improvements can be added later - MAX_LOCAL and must lock - contention scaling. v4: - fix percpu ->count buffer count which had been spliced across a debug patch. - introduce define for MAX_LOCAL_COUNT - rework count check and locking around it. - update commit message to reference commit that introduced the memory. v3: - limit number of buffers that can be pushed onto the percpu list. This avoids a problem on some kernels where one percpu list can inherit buffers from another cpu after a reschedule, causing more kernel memory to used than is necessary. Under normal conditions this should eventually return to normal but under pathelogical conditions the extra memory consumption may have been unbouanded v2: - dynamically adjust buffer hold time on percpu list based on lock contention. v1: - cache buffers on percpu list on lock contention Reported-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'crypto/md4.c')
0 files changed, 0 insertions, 0 deletions