mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chengming Zhou <zhouchengming@bytedance.com>
To: peterz@infradead.org, Suren Baghdasaryan <surenb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Cc: quic_pkondeti@quicinc.com, quic_charante@quicinc.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/psi: Fix avgs_work re-arm in psi_avgs_work()
Date: Sat, 15 Oct 2022 17:43:12 +0800	[thread overview]
Message-ID: <f7e4fe56-73b3-88e6-d6a6-6adab34f12db@bytedance.com> (raw)
In-Reply-To: <CAJuCfpEQPpVZ+0Nyb52y30y=5+XBqMqKkvQ93NZtOistrjAC1g@mail.gmail.com>

On 2022/10/15 00:41, Suren Baghdasaryan wrote:
> On Fri, Oct 14, 2022 at 7:18 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>>
>> On Fri, Oct 14, 2022 at 07:05:51PM +0800, Chengming Zhou wrote:
>>> Pavan reported a problem that PSI avgs_work idle shutoff is not
>>> working at all. Because PSI_NONIDLE condition would be observed in
>>> psi_avgs_work()->collect_percpu_times()->get_recent_times() even if
>>> only the kworker running avgs_work on the CPU.
>>>
>>> Although commit 1b69ac6b40eb ("psi: fix aggregation idle shut-off")
>>> avoided the ping-pong wake problem when the worker sleep, psi_avgs_work()
>>> still will always re-arm the avgs_work, so shutoff is not working.
>>>
>>> This patch changes to use PSI_STATE_RESCHEDULE to flag whether to
>>> re-arm avgs_work in get_recent_times(). For the current CPU, we re-arm
>>> avgs_work only when (NR_RUNNING > 1 || NR_IOWAIT > 0 || NR_MEMSTALL > 0),
>>> for other CPUs we can just check PSI_NONIDLE delta. The new flag
>>> is only used in psi_avgs_work(), so we check in get_recent_times()
>>> that current_work() is avgs_work.
>>>
>>> One potential problem is that the brief period of non-idle time
>>> incurred between the aggregation run and the kworker's dequeue will
>>> be stranded in the per-cpu buckets until avgs_work run next time.
>>> The buckets can hold 4s worth of time, and future activity will wake
>>> the avgs_work with a 2s delay, giving us 2s worth of data we can leave
>>> behind when shut off the avgs_work. If the kworker run other works after
>>> avgs_work shut off and doesn't have any scheduler activities for 2s,
>>> this maybe a problem.
>>>
>>> Reported-by: Pavan Kondeti <quic_pkondeti@quicinc.com>
>>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>>
>> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> 
> Please make sure to test the final version. With that done,
> 
> Acked-by: Suren Baghdasaryan <surenb@google.com>

Thanks! Yes, I did test with this version on VM yesterday, so add:

Tested-by: Chengming Zhou <zhouchengming@bytedance.com>


  reply	other threads:[~2022-10-15  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 11:05 Chengming Zhou
2022-10-14 14:18 ` Johannes Weiner
2022-10-14 16:41   ` Suren Baghdasaryan
2022-10-15  9:43     ` Chengming Zhou [this message]
2022-10-31 10:53 ` [tip: sched/core] " tip-bot2 for 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=f7e4fe56-73b3-88e6-d6a6-6adab34f12db@bytedance.com \
    --to=zhouchengming@bytedance.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=quic_charante@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=surenb@google.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®