All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>, Lorenzo Stoakes <ljs@kernel.org>
Cc: akpm@linux-foundation.org, liam@infradead.org, vbabka@kernel.org,
	willy@infradead.org, jannh@google.com, paulmck@kernel.org,
	pfalcato@suse.de, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH 2/2] fs/proc/task_mmu: read proc/pid/smaps_rollup under per-vma lock
Date: Wed, 10 Jun 2026 17:01:57 +0200	[thread overview]
Message-ID: <d05e51a6-428a-420e-b6ba-54f94d029f1e@kernel.org> (raw)
In-Reply-To: <CAJuCfpHX5zoaD9XxDGbpXHs5U_8OrRyRuk=Nx8CjDb5qMNy0jA@mail.gmail.com>

On 6/10/26 16:56, Suren Baghdasaryan wrote:
> On Wed, Jun 10, 2026 at 12:05 AM Lorenzo Stoakes <ljs@kernel.org> wrote:
>>
>> On Tue, Jun 09, 2026 at 10:11:03AM -0700, Suren Baghdasaryan wrote:
>>>
>>> Ack.
>>>
>>>
>>> Ack.
>>>
>>>
>>> Sadly, for now we do (see my later comment).
>>>
>>>
>>> It looked nicer I think :)
>>
>> Yeah tbh I think you're right
>>
>>>
>>>
>>> Ack.
>>>
>>>
>>> We need it to avoid resetting vma_start, which is being reported even
>>> when no normal VMAs are present.
>>
>> Well previously smap_gather_stats() would just be a no-op for a gate VMA, as it
>> has:
>>
>>         if (vma == get_gate_vma(priv->lock_ctx.mm))
>>                 return;
>>
>> Not sure if you'd have VMAs past that (is that even possible?) but in that case
>> we would have set vma_start previously.
> 
> I should explain this case in more detail. proc_get_vma() returns a
> gate VMA once it finds no more VMAs. So, in this case if VMA tree is
> empty, the first call to proc_get_vma() will return gate VMA. Now, the
> original code was using vma_next() and would return NULL when the VMA
> tree is empty and in that case it would bail out early here:
> https://elixir.bootlin.com/linux/v7.1-rc7/source/fs/proc/task_mmu.c#L1423.
> I need to use proc_get_vma() instead of vma_next() because it works
> under RCU. So, the new code matches the previous behavior, but the
> condition is different. I'll see if I can resolve this in a nicer way
> but that's the gist of it.

I guess some well-named helper that encapsulates the check would already help.
But maybe the whole logic can be overhauled.

-- 
Cheers,

David

  reply	other threads:[~2026-06-10 15:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-06  1:57 [PATCH 1/2] fs/proc/task_mmu: change lock_vma_range() to return error code Suren Baghdasaryan
2026-06-06  1:57 ` [PATCH 2/2] fs/proc/task_mmu: read proc/pid/smaps_rollup under per-vma lock Suren Baghdasaryan
2026-06-06  2:00   ` Suren Baghdasaryan
2026-06-06  8:12   ` Lorenzo Stoakes
2026-06-07 19:45     ` Suren Baghdasaryan
2026-06-08  8:14       ` Lorenzo Stoakes
2026-06-08 15:32         ` David Hildenbrand (Arm)
2026-06-08 15:44           ` Suren Baghdasaryan
2026-06-08 15:43         ` Suren Baghdasaryan
2026-06-08 15:52   ` David Hildenbrand (Arm)
2026-06-08 16:20     ` Suren Baghdasaryan
2026-06-09 10:00   ` Lorenzo Stoakes
2026-06-09 17:11     ` Suren Baghdasaryan
2026-06-10  7:05       ` Lorenzo Stoakes
2026-06-10 14:56         ` Suren Baghdasaryan
2026-06-10 15:01           ` David Hildenbrand (Arm) [this message]
2026-06-10 16:00             ` Suren Baghdasaryan
2026-06-08 15:38 ` [PATCH 1/2] fs/proc/task_mmu: change lock_vma_range() to return error code David Hildenbrand (Arm)
2026-06-08 15:43   ` Suren Baghdasaryan
2026-06-09  8:27 ` Lorenzo Stoakes
2026-06-09 17:13   ` Suren Baghdasaryan

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=d05e51a6-428a-420e-b6ba-54f94d029f1e@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=jannh@google.com \
    --cc=liam@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pfalcato@suse.de \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.