All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Hui Zhu" <hui.zhu@linux.dev>, "Kurt Lin" <lylin1023@gmail.com>,
	"Hui Zhu" <zhuhui@kylinos.cn>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	<bpf@vger.kernel.org>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Barry Song" <baohua@kernel.org>, "Shuah Khan" <shuah@kernel.org>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: Fall back when memcg_proactive_reclaim data lands in shmem
Date: Thu, 19 Nov 2026 03:45:50 +0000	[thread overview]
Message-ID: <DMYVN8WPV380.3ID1QHDI7BKUS@gmail.com> (raw)
In-Reply-To: <79797479-029f-4e9b-8076-6a92a2a70cdd@linux.dev>

On Wed, Nov 18, 2026 at 07:04 PM Hui Zhu <hui.zhu@linux.dev> wrote:
> What about two things: only check when the test fails, and check
> KPF_SWAPBACKED instead of f_type?

It's still overkill. 50 lines instead of one more compare per test.
It doesn't cover arena_memcg. The failure there is a dead child,
and its O_TMPFILE is gone.

> 1. Check only when the test fails.
> What the test needs is "these pages are reclaimable", not "these pages
> are not shmem": with swap available shmem reclaims fine, and then
> reclaimed == 0 is a real regression that must not be skipped. So probe on
> the failure path only -- nothing is paid when the test passes, there is
> no polling, and a regression cannot be masked.

It can. Kurt's guest has no swap, and /tmp is overlayfs over tmpfs.
Make bpf_proactive_reclaim() return 0 there:

  skel->bss->reclaimed      0
  si.totalswap              0
  file_is_shmem(data_fd)    1    -> test__skip()

With the f_type check workload_dir() moves on to "." and the test
fails as it should.

Swap alone is not enough either. The prog passes swappiness -1.
With vm.swappiness == 0 get_scan_count() doesn't scan shmem:

	if (cgroup_reclaim(sc) && !swappiness) {
		scan_balance = SCAN_FILE;

So reclaimed == 0 with swap on is not always a regression.

> 2. Probe with KPF_SWAPBACKED.
> f_type is a blacklist, so the next stacking filesystem repeats this.
> shmem-ness is a property of the pages rather than of the mount, so ask
> the pages: /proc/self/pagemap for VA -> PFN, /proc/kpageflags for
> PFN -> flags, then test bit 14.

Bit 14 doesn't replace f_type. ramfs pages are unevictable and not
swapbacked. file_is_shmem() returns 0 and the test fails.
Let's deal with the next stacking fs when somebody hits it.

      reply	other threads:[~2026-11-19  3:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 17:07 [PATCH bpf-next v2] selftests/bpf: Fall back when memcg_proactive_reclaim data lands in shmem Kurt Lin
2026-11-18  3:49 ` Alexei Starovoitov
2026-11-19  3:04   ` Hui Zhu
2026-11-19  3:45     ` Alexei Starovoitov [this message]

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=DMYVN8WPV380.3ID1QHDI7BKUS@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=baohua@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=hui.zhu@linux.dev \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lylin1023@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=zhuhui@kylinos.cn \
    /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.