All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Chengming Zhou <zhouchengming@bytedance.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	songmuchun@bytedance.com
Subject: Re: [PATCH v2 4/4] psi: Optimize task switch inside shared cgroups
Date: Wed, 3 Mar 2021 09:57:43 -0500	[thread overview]
Message-ID: <YD+j56JtFTfOjNjt@cmpxchg.org> (raw)
In-Reply-To: <20210303034659.91735-5-zhouchengming@bytedance.com>

On Wed, Mar 03, 2021 at 11:46:59AM +0800, Chengming Zhou wrote:
> The commit 36b238d57172 ("psi: Optimize switching tasks inside shared
> cgroups") only update cgroups whose state actually changes during a
> task switch only in task preempt case, not in task sleep case.
> 
> We actually don't need to clear and set TSK_ONCPU state for common cgroups
> of next and prev task in sleep case, that can save many psi_group_change
> especially when most activity comes from one leaf cgroup.
> 
> sleep before:
> psi_dequeue()
>   while ((group = iterate_groups(prev)))  # all ancestors
>     psi_group_change(prev, .clear=TSK_RUNNING|TSK_ONCPU)
> psi_task_switch()
>   while ((group = iterate_groups(next)))  # all ancestors
>     psi_group_change(next, .set=TSK_ONCPU)
> 
> sleep after:
> psi_dequeue()
>   nop
> psi_task_switch()
>   while ((group = iterate_groups(next)))  # until (prev & next)
>     psi_group_change(next, .set=TSK_ONCPU)
>   while ((group = iterate_groups(prev)))  # all ancestors
>     psi_group_change(prev, .clear=common?TSK_RUNNING:TSK_RUNNING|TSK_ONCPU)
> 
> When a voluntary sleep switches to another task, we remove one call of
> psi_group_change() for every common cgroup ancestor of the two tasks.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

  reply	other threads:[~2021-03-03 18:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  3:46 [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization Chengming Zhou
2021-03-03  3:46 ` [PATCH v2 1/4] psi: Add PSI_CPU_FULL state Chengming Zhou
2021-03-04  9:09   ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42   ` tip-bot2 for Chengming Zhou
2021-03-03  3:46 ` [PATCH v2 2/4] psi: Use ONCPU state tracking machinery to detect reclaim Chengming Zhou
2021-03-03 14:56   ` Johannes Weiner
2021-03-03 15:52   ` Peter Zijlstra
2021-03-04  9:09   ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42   ` tip-bot2 for Chengming Zhou
2021-03-03  3:46 ` [PATCH v2 3/4] psi: pressure states are unlikely Chengming Zhou
2021-03-04  9:09   ` [tip: sched/core] psi: Pressure " tip-bot2 for Johannes Weiner
2021-03-06 11:42   ` tip-bot2 for Johannes Weiner
2021-03-03  3:46 ` [PATCH v2 4/4] psi: Optimize task switch inside shared cgroups Chengming Zhou
2021-03-03 14:57   ` Johannes Weiner [this message]
2021-03-03 15:53   ` Peter Zijlstra
2021-03-03 16:01     ` [External] " Muchun Song
2021-03-04  9:09   ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42   ` tip-bot2 for Chengming Zhou
2021-03-03 14:59 ` [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization Johannes Weiner
2021-03-03 15:32   ` Peter Zijlstra
2021-03-03 16:05     ` Peter Zijlstra
2021-03-03 19:38       ` Johannes Weiner
2021-03-04  0:14       ` [External] " Chengming Zhou

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=YD+j56JtFTfOjNjt@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=songmuchun@bytedance.com \
    --cc=vincent.guittot@linaro.org \
    --cc=zhouchengming@bytedance.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 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.