linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Mel Gorman <mgorman@suse.de>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Benjamin Segall <bsegall@google.com>,
	bristot@redhat.com
Cc: LKML <linux-kernel@vger.kernel.org>, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 0/6] sched: support schedstats for RT sched class
Date: Tue, 6 Apr 2021 18:41:11 +0800	[thread overview]
Message-ID: <CALOAHbDZPo65Vc89sVCuYkJ6vr=zD-4ev=JN=j7ZAzKHzRibdA@mail.gmail.com> (raw)
In-Reply-To: <20210327101254.56872-1-laoar.shao@gmail.com>

On Sat, Mar 27, 2021 at 6:13 PM Yafang Shao <laoar.shao@gmail.com> wrote:
>
> We want to measure the latency of RT tasks in our production
> environment with schedstats facility, but currently schedstats is only
> supported for fair sched class. In order to support if for other sched
> classes, we should make it independent of fair sched class. The struct
> sched_statistics is the schedular statistics of a task_struct or a
> task_group, both of which are independent of sched class. So we can move
> struct sched_statistics into struct task_struct and struct task_group to
> achieve the goal.
>
> After the patchset, schestats are orgnized as follows,
> struct task_struct {
>     ...
>     struct sched_statistics statistics;
>     ...
>     struct sched_entity *se;
>     struct sched_rt_entity *rt;
>     ...
> };
>
> struct task_group {                    |---> stats[0] : of CPU0
>     ...                                |
>     struct sched_statistics **stats; --|---> stats[1] : of CPU1
>     ...                                |
>                                        |---> stats[n] : of CPUn
>  #ifdef CONFIG_FAIR_GROUP_SCHED
>     struct sched_entity **se;
>  #endif
>  #ifdef CONFIG_RT_GROUP_SCHED
>     struct sched_rt_entity  **rt_se;
>  #endif
>     ...
> };
>
> The sched_statistics members may be frequently modified when schedstats is
> enabled, in order to avoid impacting on random data which may in the same
> cacheline with them, the struct sched_statistics is defined as cacheline
> aligned.
>
> Then we can use schedstats to trace RT tasks as well, for example,
>                     Interface File
>  task schedstats :  /proc/[pid]/sched
>  group schedstats:  /proc/sched_debug
>  tracepoints     :  sched:sched_stat_{runtime, wait, sleep, iowait, blocked}
>
> As PATCH #2 and #3 changes the core struct in the scheduler, so I did
> 'perf bench sched pipe' to measure the sched performance before and after
> the change, suggested by Mel. Below is the data, which are all in
> usecs/op.
>                              Before             After
>   kernel.sched_schedstats=0  6.0~6.1            6.0~6.1
>   kernel.sched_schedstats=1  6.2~6.4            6.2~6.4
> No obvious difference after the change.
>
> Changes since v1:
> - Fix the build failure reported by kernel test robot.
> - Add the performance data with 'perf bench sched pipe', suggested by
>   Mel.
> - Make the struct sched_statistics cacheline aligned.
> - Introduce task block time in schedstats
>
> Changes since RFC:
> - improvement of schedstats helpers, per Mel.
> - make struct schedstats independent of fair sched class
>
> Yafang Shao (6):
>   sched, fair: use __schedstat_set() in set_next_entity()
>   sched: make struct sched_statistics independent of fair sched class
>   sched: make schedstats helpers independent of fair sched class
>   sched: introduce task block time in schedstats
>   sched, rt: support sched_stat_runtime tracepoint for RT sched class
>   sched, rt: support schedstats for RT sched class
>
>  include/linux/sched.h    |   7 +-
>  kernel/sched/core.c      |  24 +++--
>  kernel/sched/deadline.c  |   4 +-
>  kernel/sched/debug.c     |  90 +++++++++--------
>  kernel/sched/fair.c      | 210 ++++++++++++++++-----------------------
>  kernel/sched/rt.c        | 143 +++++++++++++++++++++++++-
>  kernel/sched/sched.h     |   3 +
>  kernel/sched/stats.c     | 104 +++++++++++++++++++
>  kernel/sched/stats.h     |  89 +++++++++++++++++
>  kernel/sched/stop_task.c |   4 +-
>  10 files changed, 489 insertions(+), 189 deletions(-)
>
> --
> 2.18.2
>

Peter, Ingo, Mel,

Any comments on this version ?

-- 
Thanks
Yafang

      parent reply	other threads:[~2021-04-06 10:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 10:12 [PATCH v2 0/6] sched: support schedstats for RT sched class Yafang Shao
2021-03-27 10:12 ` [PATCH v2 1/6] sched, fair: use __schedstat_set() in set_next_entity() Yafang Shao
2021-03-27 10:12 ` [PATCH v2 2/6] sched: make struct sched_statistics independent of fair sched class Yafang Shao
2021-03-27 10:12 ` [PATCH v2 3/6] sched: make schedstats helpers " Yafang Shao
2021-03-27 10:12 ` [PATCH v2 4/6] sched: introduce task block time in schedstats Yafang Shao
2021-03-27 10:12 ` [PATCH v2 5/6] sched, rt: support sched_stat_runtime tracepoint for RT sched class Yafang Shao
2021-03-27 10:12 ` [PATCH v2 6/6] sched, rt: support schedstats " Yafang Shao
2021-04-06 10:41 ` Yafang Shao [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='CALOAHbDZPo65Vc89sVCuYkJ6vr=zD-4ev=JN=j7ZAzKHzRibdA@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --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=linux-rt-users@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).