From: SJ Park <sj@kernel.org>
To: Song Hu <husong@kylinos.cn>
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: Question on damon_sysfs_memcg_path_to_id() path resolution
Date: Mon, 20 Jul 2026 08:11:42 -0700 [thread overview]
Message-ID: <20260720151143.83277-1-sj@kernel.org> (raw)
In-Reply-To: <c4cf2558-0516-417e-affd-9a5550ff32f8@kylinos.cn>
On Mon, 20 Jul 2026 11:35:06 +0800 Song Hu <husong@kylinos.cn> wrote:
[...]
> The only in-kernel PSI consumer today is DAMON, and it reads a single
> system-wide value - psi_system.total for memory (mm/damon/core.c,
> damos_get_some_mem_psi_total). There is no reusable in-kernel helper that
> returns per-cgroup, multi-domain (cpu/mem/io x some/full) pressure as a
> value (psi_show is a seq_file printer for the /proc and cgroup files, not a
> value-returning API), and no in-kernel threshold-trigger (psi_trigger_create
> is userspace-fd only).
>
> I'm writing a node-level multi-domain (cpu + memory + io) resource
> coordinator for container/Kubernetes nodes - a small C daemon using libbpf
> plus PSI trigger fds. To attribute pressure to specific cgroups and act
> across domains it needs per-cgroup, per-domain PSI,
Sounds interesting!
> which today means
> open-coding reads of cgroup_psi(cgrp)->total[] the way DAMON does in-kernel.
> And I think DAMON's own per-memcg DAMOS quota goals would benefit from the
> same per-cgroup read if it existed.
>
> So the idea is a small helper, e.g.
>
> /* per-cgroup, per-domain pressure; reuses update_averages() */
> u64 psi_cgroup_total(struct cgroup *cgrp, enum psi_res res, bool some);
> /* and/or an avg10/60/300 variant */
>
> with DAMON migrated to it as the first in-tree user.
I'm sorry but I'm missing your points from here. Could you elaborate why we
need the helper, and why DAMON should use it?
You're implementing your system in user-space, so I don't think you will use
that helper for your system. DAMON has its internal implementation for reading
PSI. What's the benefit of the helper compared to the current one?
Also that helper may be implemented inside PSI or cgroup subsystem and
maintained by the maintainers of the subsystems. Are they willing to have this
and increase their maintenance burden?
>
> Before I do anything: does this capability gap resonate with you - is
> per-cgroup PSI consumption something you'd want DAMON to grow into, or do
> you see it staying userspace-only? And if a helper makes sense, any
> preferred shape, or concerns about exposing the averaging/locking contract?
> I'd keep the first cut to just the read helper + DAMON migration; an
> in-kernel trigger callback I'd treat as a separate, later step and only if
> there's a second consumer.
Seems you have larger picture. I don't clearly show what is it. Could you
share it at a high level? That might enlighten me.
Thanks,
SJ
[...]
prev parent reply other threads:[~2026-07-20 15:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 6:35 Question on damon_sysfs_memcg_path_to_id() path resolution Song Hu
2026-07-15 13:51 ` SJ Park
2026-07-18 8:40 ` Song Hu
2026-07-18 15:59 ` SJ Park
2026-07-20 3:35 ` Song Hu
2026-07-20 15:11 ` SJ Park [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=20260720151143.83277-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=husong@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.