The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yuanhan Zhang <zyhtheonly@gmail.com>,
	zyhtheonly@yeah.net, tglx@linutronix.de, mingo@redhat.com,
	Venkatesh Pallipadi <venki@google.com>,
	peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, linux-kernel@vger.kernel.org,
	dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, vschneid@redhat.com
Subject: Re: [PATCH v3] sched/cputime: let ktimers align with ksoftirqd in accounting CPUTIME_SOFTIRQ
Date: Fri, 8 Dec 2023 10:26:16 +0100	[thread overview]
Message-ID: <20231208092616.LcwLlOyE@linutronix.de> (raw)
In-Reply-To: <20231207131811.08145840@gandalf.local.home>

On 2023-12-07 13:18:11 [-0500], Steven Rostedt wrote:
> On Thu, 7 Dec 2023 12:19:28 -0500
> Yuanhan Zhang <zyhtheonly@gmail.com> wrote:
> 
> In irqtime_account_process_tick() there's:
> 
> 	if (this_cpu_ksoftirqd() == p) {
> 		/*
> 		 * ksoftirqd time do not get accounted in cpu_softirq_time.
> 		 * So, we have to handle it separately here.
> 		 * Also, p->stime needs to be updated for ksoftirqd.
> 		 */
> 		account_system_index_time(p, cputime, CPUTIME_SOFTIRQ);
> 
> Which to me looks like it is counting ksoftirqd for SOFTIRQ time. But
> honestly, why do we care about that? What's the difference if ksoftirqd
> were to run or softirqd were to pass work off to a workqueue?
> 
> ksoftirqd runs in vanilla Linux as SCHED_OTHER. The work it does doesn't
> interrupt processes any more than any other kernel thread. I don't know why
> we make it "special".

The special part is that it runs with disabled preemption the whole time
and the scheduler can't do a thing about it. This is different on
PREEMPT_RT where the softirq is preemptible and scheduler can replace it
with another task if suited. It still runs as SCHED_OTHER. The ktimers/
thread runs as SCHED_FIFO 1. So accounting it (incl. ksoftirqd) on
SYSTEM is fine IMHO. 

> I guess the better question I need to ask is, what is this information used
> for? I thought it was how much time was take away from tasks. As current
> would be a task, and we do care if a real softirq is running, as we do not
> want to add that to the current task accounting.
> 
> But for ksoftirqd, that's not the case, and I don't really care if it's
> running a softirq or not. As that time isn't interrupting actual tasks. Not
> to mention, one could simply look at the ksoftirqd tasks to see how much
> time they take up.

The original argument was to have the softirq counters right in
/proc/stat. This is what I remember from the trip to the museum.

> -- Steve

Sebastian

  reply	other threads:[~2023-12-08  9:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24  6:34 [PATCH] sched/cputime: exclude ktimer threads in irqtime_account_irq tiozhang
2023-11-27 18:07 ` Steven Rostedt
2023-11-30  9:41   ` [PATCH v2] sched/cputime: exclude ktimers " tiozhang
2023-11-30 12:00     ` Sebastian Andrzej Siewior
2023-12-01  7:27       ` Yuanhan Zhang
2023-12-01  7:32         ` Sebastian Andrzej Siewior
2023-12-01  8:05           ` [PATCH v3] sched/cputime: let ktimers align with ksoftirqd in accounting CPUTIME_SOFTIRQ tiozhang
2023-12-01 16:16             ` Sebastian Andrzej Siewior
2023-12-02 10:28               ` Yuanhan Zhang
2023-12-05 15:31                 ` Sebastian Andrzej Siewior
2023-12-07 10:43                   ` Yuanhan Zhang
2023-12-07 15:35                     ` Steven Rostedt
2023-12-07 17:19                       ` Yuanhan Zhang
2023-12-07 18:18                         ` Steven Rostedt
2023-12-08  9:26                           ` Sebastian Andrzej Siewior [this message]
2023-12-11 12:02                             ` [PATCH v4] sched/cputime: account ksoftirqd's time on SYSTEM in PREEMPT_RT Tio Zhang
2023-12-15 18:30                             ` [PATCH v3] sched/cputime: let ktimers align with ksoftirqd in accounting CPUTIME_SOFTIRQ Yuanhan Zhang

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=20231208092616.LcwLlOyE@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=venki@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=zyhtheonly@gmail.com \
    --cc=zyhtheonly@yeah.net \
    /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