[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190930090253.GL4553@hirez.programming.kicks-ass.net>
Date: Mon, 30 Sep 2019 11:02:53 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Song Liu <songliubraving@...com>
Cc: linux-kernel@...r.kernel.org, kernel-team@...com,
Jie Meng <jmeng@...com>
Subject: Re: [PATCH] perf: rework memory accounting in perf_mmap()
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)
:/
Powered by blists - more mailing lists