Article View: linux.kernel.netdev
Article #623Re: [PATCH bpf-next v3] selftests/bpf: Add bpf_proactive_reclaim test
From: Barry Song
Date: Thu, 08 Oct 2026 11:19
Date: Thu, 08 Oct 2026 11:19
54 lines
8861 bytes
8861 bytes
On Thu, Oct 8, 2026 at 3:10 PM Hui Zhu <hui.zhu@linux.dev> wrote:
>
> From: Hui Zhu <zhuhui@kylinos.cn>
>
> bpf_proactive_reclaim() performs one bounded reclaim pass per call and,
> unlike a write to memory.reclaim, does not retry until the goal is
> reached.
>
> Charge 32 MiB of page cache to a cgroup, ask for all of it in one call,
> and check that the result is positive but well below the request: one
> pass is capped at MEMCG_CHARGE_BATCH pages, far short of 32 MiB on both
> 4K and 64K page kernels.
>
> The test deliberately covers only the kfunc itself. A full example of
> the intended asynchronous use, where a BPF program watches one cgroup's
> workingset refaults and reclaims another one from bpf_wq callbacks, is
> maintained out of tree at [1], released under GPLv2.
>
> Add CONFIG_MEMCG to the config fragment, without which mm/bpf_memcontrol.c
> is not built at all.
>
> [1] https://github.com/teawater/memcg-async-reclaim
>
> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
[...]
> +
> + /*
> + * Both candidate directories can be tmpfs (initramfs-based CI, for
> + * instance). That is an environment limitation, not a test failure.
> + */
> + dir = workload_dir();
> + if (!dir) {
> + test__skip();
> + return;
> + }
> +
> + snprintf(data_file, sizeof(data_file),
> + "%s/memcg_proactive_reclaim_XXXXXX", dir);
> + data_fd = mkstemp(data_file);
If we can't write to the directory, will `mkstemp()` fail?
Should we check `access(dir, W_OK)` first?
> + if (!ASSERT_GE(data_fd, 0, "mkstemp"))
> + return;
> +
Best Regards
Barry
Technical Details
Message-ID:
<CAGsJ_4wW=XXe6=1GucvA1pUSkhLCosJh+bc0-97cYGGWW=MtPw@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342912-linux-kernel-netdev=dewy.ruReferences:
<20261008070928.113530-1-hui.zhu@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342912-linux-kernel-netdev=dewy.ru
From: baohua@kernel.org (Barry Song)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf-next v3] selftests/bpf: Add bpf_proactive_reclaim test
Date: Thu, 8 Oct 2026 19:19:00 +0800
Organization: Usenet Network
Message-ID: <CAGsJ_4wW=XXe6=1GucvA1pUSkhLCosJh+bc0-97cYGGWW=MtPw@mail.gmail.com>
References: <20261008070928.113530-1-hui.zhu@linux.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="865561"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+bB1q3I4A40ontvh+KQNxMpk1M8= sha256:a0F5xAKtZQkaEHaPfzRoWXufmG1WKoVD+/MGrNS7vT0=
sha1:LeEY8aRaINNYyUMSl0m83yrZfbI= sha256:GNBo3Y71lI1ZI2Jrw2OTeVMGG2GSywYgQwCZ3Nf79HY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 9C40C10F32E; Thu, 8 Oct 2026 14:21:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 2BsaFTCOdRsd;
Thu, 8 Oct 2026 14:21:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342912-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 0739F10F3A9; Thu, 8 Oct 2026 14:20:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 3B7EB312C8; Thu, 8 Oct 2026 11:19:14 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0890D44E67F;
Thu, 8 Oct 2026 11:19:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nC4yXMux"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D8503C10AB
for <netdev@vger.kernel.org>; Thu, 8 Oct 2026 11:19:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791458353; cv=none; b=qddC55CBxF8hK8KGb+7+uO950rVtCWk/pNrRqFMXwVhHoTIAsRCD+Y3tpgyKoVfg5eM73XaAgVS+z0GUvy1oOZ8bWbG14NkjGuJ6Jf1aJoUXnulrG/Vg9S3Z+ptLowqVFG/xdvhkTDDwoAlPnbuKrw/iWm8CUlskXeV7tX7rliA=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791458353; c=relaxed/simple;
bh=2iWKgdjnY/WKT1NRrSPFsVEZgqb3q8rtw1j3YXKRPfs=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=AIgRef65KObjPvarfAny+fOW02A1HZZ1RUaaKVwgO0Uo9E0o1TijnTN/VfjyflWM2fYGgXwF0QTagKDFDSwAhNEOJLD2QVggfViTHHKf0sK/UGrOIr0N6fPCSihx3BVo/yh9XeDRsRtF1E8eJkVwMunOS2DMZt9DY0EaKoqDEAI=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nC4yXMux; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 203161F0089B
for <netdev@vger.kernel.org>; Thu, 8 Oct 2026 11:19:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1791458352;
bh=NZcC7/xg5SS/eaNUvNNF7JTQ0EBiXnoG/PlgqRlweyg=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=nC4yXMuxmMjU60Le+2fG+FqvSiQ7rKPZNcghMiB9i2JnmXYHvWr8CHGKo+cUg3eyC
tyz9yAp6jv7crdC0S35QVoCksEC9JaXnDlY8BJ92Nf36FysG12iKwvFwx8xsakSXKy
hHhua4yCU8H6sT3Xu229n9WyhY6PlU5iQcUSNzEwcKrCe/nMCecXfR8WB5n6dvNo6f
h8epILmsasVrPcPpm7tSqZOm0INZWaRL80oyengNFl01gcPbbCiOhUsXqei+Xm4juT
P43mQ9wQ4SqKMvX/hVwh7JPj7Cu8DxPF4NEFqi6yryVN3JWVxwD8OLfJSS7Q5cMgL0
ipSoSLdzkMJ/g==
X-Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-93e76469b93so281816385a.0
for <netdev@vger.kernel.org>; Thu, 08 Oct 2026 04:19:12 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvByc3y58sa6MFdBKY8/qGCvQDr5ipAZOz+DAlBexmJktwC0lR8nlP2rLdJlEb2BL6vJWSfv2S6I=@vger.kernel.org
X-Gm-Message-State: AFuF++nRXP4IUijy4my81B8vMRvx8qkgpJdlKVknAs/tdyP1Io8MJ+vQ
OIt3yF+2HbeNOuEydEqgp2iufUn+D52wQTG6Q5P0tfaqHLlf2K7iPOw96lvFHg5yP1ArP/5y1nR
HAyJz+HqqMXCmnoYm3e170SvwGAb0dX4=
X-Received: by 2002:a05:620a:4709:b0:939:761c:4f59 with SMTP id
af79cd13be357-93e9b76c78amr924707585a.16.1791458351308; Thu, 08 Oct 2026
04:19:11 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261008070928.113530-1-hui.zhu@linux.dev>
X-Gmail-Original-Message-ID: <CAGsJ_4wW=XXe6=1GucvA1pUSkhLCosJh+bc0-97cYGGWW=MtPw@mail.gmail.com>
X-Gm-Features: AclHuK9Y4gxfKhBzGtl0K9V-EYLUU5MKewRW9HUXdq9571fi07WGLf_34qgAkY8
X-Cc: Roman Gushchin <roman.gushchin@linux.dev>, JP Kobryn <inwardvessel@gmail.com>,
Shakeel Butt <shakeel.butt@linux.dev>, Andrew Morton <akpm@linux-foundation.org>,
Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>, Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>, Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>, Shuah Khan <shuah@kernel.org>,
David Hildenbrand <david@kernel.org>, Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>, linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
Hui Zhu <zhuhui@kylinos.cn>