From: Peter Zijlstra <peterz@infradead.org>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] sched: Account per task_group nr_iowait
Date: Mon, 6 Nov 2017 17:06:21 +0100 [thread overview]
Message-ID: <20171106160621.GK3165@worktop.lehotels.local> (raw)
In-Reply-To: <150997923220.4082.7025655919924328239.stgit@localhost.localdomain>
On Mon, Nov 06, 2017 at 05:40:32PM +0300, Kirill Tkhai wrote:
> The patch makes number of task_group's tasks in iowait state
> be tracked separately. This may be useful for containers to
> check nr_iowait state of a single one.
>
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> ---
> kernel/sched/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> kernel/sched/sched.h | 5 +++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 712ee54edaa1..86d1ad5f49bd 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -796,12 +796,32 @@ void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
>
> static void task_iowait_start(struct rq *rq, struct task_struct *p)
> {
> +#ifdef CONFIG_CGROUP_SCHED
> + struct task_group *tg = task_group(p);
> +
> + /* Task's sched_task_group is changed under both of the below locks */
> + BUG_ON(!raw_spin_is_locked(&p->pi_lock) && !raw_spin_is_locked(&rq->lock));
We have lockdep_assert_held for that.
> + while (task_group_is_autogroup(tg))
> + tg = tg->parent;
> + atomic_inc(&tg->stat[rq->cpu].nr_iowait);
You're joking right, more atomic ops on the fast paths..
> +#endif
> +
> atomic_inc(&rq->nr_iowait);
> delayacct_blkio_start();
next prev parent reply other threads:[~2017-11-06 16:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 14:40 [PATCH 0/4] Show cpu cgroup's nr_running and nr_iowait in cpu.stat file Kirill Tkhai
2017-11-06 14:40 ` [PATCH 1/4] sched: Move manipulations with nr_iowait counter to separate functions Kirill Tkhai
2017-11-06 14:40 ` [PATCH 2/4] sched: Account per task_group nr_iowait Kirill Tkhai
2017-11-06 16:06 ` Peter Zijlstra [this message]
2017-11-06 16:12 ` Kirill Tkhai
2017-11-06 16:24 ` Peter Zijlstra
2017-11-06 16:25 ` Peter Zijlstra
2017-11-06 14:40 ` [PATCH 3/4] sched: Export per task_cgroup nr_iowait to userspace Kirill Tkhai
2017-11-06 14:40 ` [PATCH 4/4] sched: Export per task_cgroup nr_running " Kirill Tkhai
2017-11-06 16:04 ` [PATCH 0/4] Show cpu cgroup's nr_running and nr_iowait in cpu.stat file Peter Zijlstra
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=20171106160621.GK3165@worktop.lehotels.local \
--to=peterz@infradead.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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
Powered by JetHome