From: Pedro Falcato <pfalcato@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
david@kernel.org, ljs@kernel.org, jannh@google.com,
liam@infradead.org, willy@infradead.org, paulmck@kernel.org,
usama.arif@linux.dev, vbabka@kernel.org,
linux-fsdevel@vger.kernel.org, yi1.lai@intel.com,
oe-lkp@lists.linux.dev, lkp@intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] selftests/proc: use RSS in /proc/pid/smaps_rollup tearing tests
Date: Mon, 2 Nov 2026 13:08:03 +0000 [thread overview]
Message-ID: <auiKq8zbQTMyY2tG@pedro-suse.tail5790ac.ts.net> (raw)
In-Reply-To: <20261101110100.90796bf33ef50307a7698dca@linux-foundation.org>
On Sun, Nov 01, 2026 at 11:01:00AM -0800, Andrew Morton wrote:
> On Sun, 1 Nov 2026 07:45:03 -0800 Suren Baghdasaryan <surenb@google.com> wrote:
>
> > Pss metrics can be affected by map count even if VMA tree stays unchanged,
> > therefore tests checking VMA tree integrity can't use them. Use Rss instead
> > and pre-populate the VMAs so that Rss changes if a VMA gets skipped or
> > double-counted.
> >
> > To ensure all test VMAs are populated with anonymous pages, remain
> > mergeable across VMA operations, and do not have their Rss changed by
> > memory reclaim:
> > - Toggle PROT_EXEC instead of PROT_WRITE between adjacent test VMAs so
> > all test VMAs remain writable and MAP_POPULATE faults in anonymous pages
> > (rather than the shared zero page, which is not accounted in Rss).
> > - Use mprotect() instead of mmap(..., MAP_FIXED) in split_vma() and
> > merge_vma() so the first page of the split VMA stays resident.
> > mprotect(..., PROT_NONE) splits the VMA without unmapping the first page
> > (pte_present() remains true for PAGE_NONE PTEs), and
> > mprotect(..., self->mod_info->prot) merges it back. Both parts of the
> > split VMA retain their non-zero Rss.
> > - Lock all present pages in the child with mlockall(MCL_CURRENT |
> > MCL_FUTURE | MCL_ONFAULT) so memory pressure cannot reclaim pages and
> > alter Rss during the test.
> > - In remap_vma(), unlock next_addr before mremap(..., MREMAP_DONTUNMAP)
> > so next_addr is not split, use mmap(..., MAP_FIXED) in patch_vma() to
> > merge the middle VMA back into addr, and exclude smaps_rollup tests
> > from test_maps_tearing_from_remap since remapping moves and unmaps the
> > page from next_addr.
>
> Thanks. This is proving tricky.
>
> My evolving reviewbot still isn't happy:
>
> : This fixes the v1 RSS issues, but two things remain.
> :
> : Alternating PROT_EXEC breaks with READ_IMPLIES_EXEC: both mappings
This is nonsense btw. Not sure we'll ever support random personality()
flags being set on selftests.
--
Pedro
next prev parent reply other threads:[~2026-11-02 13:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 15:45 Suren Baghdasaryan
2026-11-01 19:01 ` Andrew Morton
2026-11-02 13:08 ` Pedro Falcato [this message]
2026-11-02 15:31 ` Suren Baghdasaryan
2026-11-02 15:43 ` Suren Baghdasaryan
2026-11-02 16:01 ` Andrew Morton
2026-11-02 16:11 ` Suren Baghdasaryan
2026-11-02 16:15 ` Suren Baghdasaryan
2026-11-02 17:01 ` Andrew Morton
2026-11-02 17:21 ` Suren Baghdasaryan
2026-11-04 2:06 ` Suren Baghdasaryan
2026-11-02 13:26 ` Pedro Falcato
2026-11-02 15:59 ` 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=auiKq8zbQTMyY2tG@pedro-suse.tail5790ac.ts.net \
--to=pfalcato@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=paulmck@kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
--cc=yi1.lai@intel.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
all inboxes | Powered by JetHome®