linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Song Liu <songliubraving@fb.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
	Jie Meng <jmeng@fb.com>
Subject: Re: [PATCH] perf: rework memory accounting in perf_mmap()
Date: Mon, 30 Sep 2019 11:02:53 +0200	[thread overview]
Message-ID: <20190930090253.GL4553@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190904214618.3795672-1-songliubraving@fb.com>

On Wed, Sep 04, 2019 at 02:46:18PM -0700, Song Liu wrote:
> perf_mmap() always increases user->locked_vm. As a result, "extra" could
> grow bigger than "user_extra", which doesn't make sense. Here is an
> example case:
> 
> Note: Assume "user_lock_limit" is very small.
> | # of perf_mmap calls |vma->vm_mm->pinned_vm|user->locked_vm|
> | 0                    | 0                   | 0             |
> | 1                    | user_extra          | user_extra    |
> | 2                    | 3 * user_extra      | 2 * user_extra|
> | 3                    | 6 * user_extra      | 3 * user_extra|
> | 4                    | 10 * user_extra     | 4 * user_extra|
> 
> Fix this by maintaining proper user_extra and extra.

Aah, indeed.

Also, this code is unreadable (which is mostly my own fault I suppose)
:/


  parent reply	other threads:[~2019-09-30  9:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 21:46 [PATCH] perf: rework memory accounting in perf_mmap() Song Liu
2019-09-16 19:43 ` Song Liu
2019-09-16 20:10   ` Hechao Li
2019-09-30  5:33     ` Song Liu
2019-09-30  9:02 ` Peter Zijlstra [this message]
2019-10-07 16:31   ` Song Liu
2019-10-07 16:56     ` Peter Zijlstra
2019-10-09 12:59 ` [tip: perf/urgent] perf/core: Rework " tip-bot2 for Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190930090253.GL4553@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jmeng@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).