linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: Make the mlock accounting simple again
@ 2019-11-20 17:06 Alexander Shishkin
  2019-11-20 17:17 ` Song Liu
  2019-11-21 16:48 ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Shishkin @ 2019-11-20 17:06 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, linux-kernel, Jiri Olsa,
	Alexander Shishkin, songliubraving

Commit

  d44248a41337 ("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 <alexander.shishkin@linux.intel.com>
Cc: songliubraving@fb.com
---
 kernel/events/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 522438887206..059ee7116008 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5886,13 +5886,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	user_locked = atomic_long_read(&user->locked_vm) + user_extra;
 
-	if (user_locked <= user_lock_limit) {
-		/* charge all to locked_vm */
-	} else if (atomic_long_read(&user->locked_vm) >= user_lock_limit) {
-		/* charge all to pinned_vm */
-		extra = user_extra;
-		user_extra = 0;
-	} else {
+	if (user_locked > user_lock_limit) {
 		/*
 		 * charge locked_vm until it hits user_lock_limit;
 		 * charge the rest from pinned_vm
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Make the mlock accounting simple again
  2019-11-20 17:06 [PATCH] perf: Make the mlock accounting simple again Alexander Shishkin
@ 2019-11-20 17:17 ` Song Liu
  2019-11-21 16:48 ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2019-11-20 17:17 UTC (permalink / raw)
  To: Alexander Shishkin
  Cc: Peter Zijlstra, Arnaldo Carvalho de Melo, Ingo Molnar,
	linux-kernel, Jiri Olsa



> On Nov 20, 2019, at 9:06 AM, Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:
> 
> Commit
> 
>  d44248a41337 ("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 <alexander.shishkin@linux.intel.com>
> Cc: songliubraving@fb.com

Acked-by: Song Liu <songliubraving@fb.com>

Thanks for the fix!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: perf/urgent] perf/core: Make the mlock accounting simple again
  2019-11-20 17:06 [PATCH] perf: Make the mlock accounting simple again Alexander Shishkin
  2019-11-20 17:17 ` Song Liu
@ 2019-11-21 16:48 ` tip-bot2 for Alexander Shishkin
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Alexander Shishkin @ 2019-11-21 16:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Alexander Shishkin, Song Liu, Arnaldo Carvalho de Melo,
	Jiri Olsa, Peter Zijlstra, Wanpeng Li, Yauheni Kaliuta,
	Ingo Molnar, x86, LKML

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     c4b75479741c9c3a4f0abff5baa5013d27640ac1
Gitweb:        https://git.kernel.org/tip/c4b75479741c9c3a4f0abff5baa5013d27640ac1
Author:        Alexander Shishkin <alexander.shishkin@linux.intel.com>
AuthorDate:    Wed, 20 Nov 2019 19:06:40 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 21 Nov 2019 07:37:50 +01:00

perf/core: Make the mlock accounting simple again

Commit:

  d44248a41337 ("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 <alexander.shishkin@linux.intel.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpengli@tencent.com>
Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Cc: songliubraving@fb.com
Link: https://lkml.kernel.org/r/20191120170640.54123-1-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/events/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 8f66a48..7e8980d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5825,13 +5825,7 @@ accounting:
 
 	user_locked = atomic_long_read(&user->locked_vm) + user_extra;
 
-	if (user_locked <= user_lock_limit) {
-		/* charge all to locked_vm */
-	} else if (atomic_long_read(&user->locked_vm) >= user_lock_limit) {
-		/* charge all to pinned_vm */
-		extra = user_extra;
-		user_extra = 0;
-	} else {
+	if (user_locked > user_lock_limit) {
 		/*
 		 * charge locked_vm until it hits user_lock_limit;
 		 * charge the rest from pinned_vm

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-21 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 17:06 [PATCH] perf: Make the mlock accounting simple again Alexander Shishkin
2019-11-20 17:17 ` Song Liu
2019-11-21 16:48 ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).