Skip to content

Commit c4b7547

Browse files
virtuosoIngo Molnar
authored andcommitted
perf/core: Make the mlock accounting simple again
Commit: d44248a ("perf/core: Rework memory accounting in perf_mmap()") does a lot of things to the mlock accounting arithmetics, while the only thing that actually needed to happen is subtracting the part that is charged to the mm from the part that is charged to the user, so that the former isn't charged twice. Signed-off-by: Alexander Shishkin <[email protected]> Acked-by: Song Liu <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Wanpeng Li <[email protected]> Cc: Yauheni Kaliuta <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 36b3db0 commit c4b7547

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

kernel/events/core.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5825,13 +5825,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
58255825

58265826
user_locked = atomic_long_read(&user->locked_vm) + user_extra;
58275827

5828-
if (user_locked <= user_lock_limit) {
5829-
/* charge all to locked_vm */
5830-
} else if (atomic_long_read(&user->locked_vm) >= user_lock_limit) {
5831-
/* charge all to pinned_vm */
5832-
extra = user_extra;
5833-
user_extra = 0;
5834-
} else {
5828+
if (user_locked > user_lock_limit) {
58355829
/*
58365830
* charge locked_vm until it hits user_lock_limit;
58375831
* charge the rest from pinned_vm

0 commit comments

Comments
 (0)