mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: John Stultz <jstultz@google.com>, Tejun Heo <tj@kernel.org>
Cc: Hui Su <sh_def@163.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Koutny <mkoutny@suse.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched: Account cgroup CPU time to the execution context
Date: Wed,  9 Sep 2026 15:08:43 +0900	[thread overview]
Message-ID: <20260909060843.2524877-1-sh_def@163.com> (raw)
In-Reply-To: <CANDhNCq5iPq87=iKSJv-XzYzTYJ8Hp+bPJ6SoVfWB3pRa=HypQ@mail.gmail.com>

On Tue, Sep 8, 2026 at 10:17 PM John Stultz <jstultz@google.com> wrote:
>
> I believe I'm ok with this if you are. Commit aa4f74dfd42b ("sched:
> Fix runtime accounting w/ split exec & sched contexts") was trying to
> allow the owner's cputime to make sense in top, but we still want the
> donor to be "donating" their time, so I thought the compromise of
> charging the donor's cgroup would make more sense. I'm imagining
> something like the cpu bandwidth controllers, where it seemed like the
> donor's cgroup is who we'd want to charge, and eventually throttle,
> even though it is donating time to the lock owner to run (since even
> if the lock owner's cgroup was throttled, proxying will let the donor
> "bust" through the limit and run the lock owner using the donor's
> bandwidth - up until the donor's bandwidth was exceeded).
>
> But if it is causing trouble for the accounting, and you think it
> makes more sense the other way, I'll trust your judgement.
> Tentatively:
>    Acked-by: John Stultz <jstultz@google.com>
>
> Eventually I think we'll want to track per-task "donated" and "gifted"
> time so folks can more finely distinguish the accounting.
>
> thanks
> -john

Thanks John and Tejun.

One distinction that may help here is that this patch only changes the
cgroup CPU usage accounting performed by cgroup_account_cputime(). It
does not change CFS bandwidth accounting.

Under proxy execution, update_curr() still accounts CFS bandwidth
through account_cfs_rq_runtime() on the cfs_rq associated with the
scheduling context. Thus, the donor's scheduling bandwidth continues
to be consumed as before; this patch does not change the bandwidth or
throttling behavior John described.

The change here only makes the observable cgroup CPU usage accounting
follow the task that actually executed, in line with the per-task,
thread-group, and cgroup user/system accounting.

The donated/gifted accounting you mention sounds useful for exposing
both sides explicitly, but I agree that would be separate follow-up
work.

Thanks,
Hui


  reply	other threads:[~2026-09-09  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  3:47 Hui Su
2026-09-04  6:37 ` Tejun Heo
2026-09-09  5:17   ` John Stultz
2026-09-09  6:08     ` Hui Su [this message]
2026-09-09 17:48     ` Tejun Heo
2026-09-10  9:02 ` [tip: sched/urgent] " tip-bot2 for Hui Su

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=20260909060843.2524877-1-sh_def@163.com \
    --to=sh_def@163.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®