From: Qais Yousef <qyousef@layalina.io>
To: Hao Luo <haoluo@google.com>, Juri Lelli <juri.lelli@redhat.com>
Cc: Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, Waiman Long <longman@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
tj@kernel.org, linux-kernel@vger.kernel.org,
luca.abeni@santannapisa.it, claudio@evidence.eu.com,
tommaso.cucinotta@santannapisa.it, bristot@redhat.com,
mathieu.poirier@linaro.org, cgroups@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Wei Wang <wvw@google.com>, Rick Yiu <rickyiu@google.com>,
Quentin Perret <qperret@google.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Zefan Li <lizefan.x@bytedance.com>,
linux-s390@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v3] sched: cpuset: Don't rebuild root domains on suspend-resume
Date: Sat, 11 Mar 2023 18:51:50 +0000 [thread overview]
Message-ID: <20230311185150.stvtcbdkoofgn3wd@airbuntu> (raw)
In-Reply-To: <CA+khW7iAeTALH5b6upHXs1RotFBohVeZCcAp5H+r-=L05kqnww@mail.gmail.com>
On 03/09/23 14:23, Hao Luo wrote:
> On Wed, Mar 8, 2023 at 10:55 PM Juri Lelli <juri.lelli@redhat.com> wrote:
> >
> > On 08/03/23 10:01, Hao Luo wrote:
> > > On Wed, Mar 8, 2023 at 2:20 AM Juri Lelli <juri.lelli@redhat.com> wrote:
> > > >
> > > > On 01/03/23 17:03, Qais Yousef wrote:
> > > > > On 03/01/23 15:26, Juri Lelli wrote:
> > > <...>
> > > > > > BTW, do you have a repro script of some sort handy I might play with?
> > > > >
> > > > > Sorry no. You'll just need to suspend to ram. I had a simple patch to measure
> > > > > the time around the call and trace_printk'ed the result.
> > > > >
> > > > > I was working on a android phone which just suspends to ram if you turn the
> > > > > screen off and disconnect the usb.
> > > >
> > > > Looks like I could come up with the following
> > > >
> > > > https://github.com/jlelli/linux.git deadline/rework-cpusets
> > > > https://github.com/jlelli/linux/tree/deadline/rework-cpusets
> > > >
> > > > which I don't think it's at a point that I feel comfortable to propose
> > > > as an RFC (not even sure if it actually makes sense), but it survived my
> > > > very light testing.
> > > >
> > > > Could you please take a look and, if it makes some sense in theory, give
> > > > it a try on your end?
> > > >
> > >
> > > Hi Juri,
> > >
> > > Thanks for coming up with the RFC. I can test your changes in the
> > > server environment. I observed the same issue on my side and I can
> > > reproduce.
> > >
> > > I sync'ed up with Qais offline earlier yesterday, and was preparing a
> > > couple of patches that optimize the cpuset.cpus writes. Tracking dl
> > > tasks in cpusets is one of them. But I am happy to take your patches
> > > and do the testing. Note that I won't be able to test the dl part of
> > > the patch, only the latency impact on rebuild_root_domains(), as we
> > > don't have dl tasks in our system.
> > >
> > > The other patch is fixing cpuset_rwsem. I see you switched it back to
> > > mutex. I did observe performance issues with cpuset_rwsem. Basically,
> > > using percpu_rwsem generates very very long latency tails for writers,
> > > but mutex doesn't. After some debugging, I found it was because
> > > percpu_rwsem requires every writer to call a synchronize_rcu() for
> > > acquiring the lock. So in my patches, I disabled the fastpath of
> > > readers for cpuset_rwsem. This has been done before[1]. But mutex also
> > > worked.
> > >
> > > Anyway, I'm happy to test your patches and ack once they are sent out.
> >
> > Do you strictly need a proper RFC or could you please test the above for
> > now? If you could please do the latter, and if tests look ok, I could
> > then put together proper changelogs etc. and propose an RFC (it would
> > save me some time not to do that if the above doesn't work, apologies
> > for not going the proper route from the start). Guess this question
> > applies to Qais as well. Hummm, or maybe you are actually saying that
> > you are indeed going to test them already, just wanted to make sure
> > then. :)
>
> Juri, I ported your patches to a 5.10 kernel, because my workload can
> only run on 5.10. But unfortunately the kernel crashed at
> cpuset_can_attach(). I'll put a few comments in your github branch.
Yeah I am working on 5.10 too (this will need to be backported to 5.10 and 5.15
ultimately) and had the same crash because task is NULL.
Fixed it this way which I think what you intended to do Juri? It moves the
check for dl_task(task) inside cgroup_taskset_for_each() loop.
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 83a8943467fb..06d6bb68d86b 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2495,11 +2495,11 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
ret = security_task_setscheduler(task);
if (ret)
goto out_unlock;
- }
- if (dl_task(task)) {
- cs->deadline_tasks++;
- cpuset_attach_old_cs->deadline_tasks--;
+ if (dl_task(task)) {
+ cs->deadline_tasks++;
+ cpuset_attach_old_cs->deadline_tasks--;
+ }
}
/*
Like Hao I don't have any deadline tasks in the system. With the fix above
I don't notice the delay on suspend resume using your patches.
If you want any debug; please feel free to add them into your branch so I can
run with that and give you the log.
Thanks!
--
Qais Yousef
next prev parent reply other threads:[~2023-03-11 18:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 22:14 [PATCH v3] sched: cpuset: Don't rebuild root domains on suspend-resume Qais Yousef
2023-02-23 15:38 ` Qais Yousef
2023-02-24 15:14 ` Dietmar Eggemann
2023-02-27 20:57 ` Qais Yousef
2023-02-28 14:09 ` Dietmar Eggemann
2023-02-28 17:46 ` Qais Yousef
2023-03-01 7:31 ` Juri Lelli
2023-03-01 12:28 ` Qais Yousef
2023-03-01 14:26 ` Juri Lelli
2023-03-01 17:03 ` Qais Yousef
2023-03-08 10:19 ` Juri Lelli
2023-03-08 18:01 ` Hao Luo
2023-03-09 6:55 ` Juri Lelli
2023-03-09 22:23 ` Hao Luo
2023-03-11 18:51 ` Qais Yousef [this message]
2023-03-13 16:37 ` Juri Lelli
2023-03-13 17:10 ` Dietmar Eggemann
2023-03-14 11:41 ` Dietmar Eggemann
2023-03-08 19:21 ` Waiman Long
2023-03-13 12:37 ` Dietmar Eggemann
2023-03-07 19:56 ` Hao Luo
2023-03-07 20:08 ` Waiman Long
2023-03-07 21:06 ` Hao Luo
2023-03-07 21:13 ` Waiman Long
2023-03-07 22:17 ` Hao Luo
2023-03-08 2:29 ` Waiman Long
2023-03-08 18:11 ` Hao Luo
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=20230311185150.stvtcbdkoofgn3wd@airbuntu \
--to=qyousef@layalina.io \
--cc=agordeev@linux.ibm.com \
--cc=bristot@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=claudio@evidence.eu.com \
--cc=dietmar.eggemann@arm.com \
--cc=gor@linux.ibm.com \
--cc=haoluo@google.com \
--cc=hca@linux.ibm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=luca.abeni@santannapisa.it \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=qperret@google.com \
--cc=rickyiu@google.com \
--cc=rostedt@goodmis.org \
--cc=sudeep.holla@arm.com \
--cc=tj@kernel.org \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
--cc=wvw@google.com \
--cc=x86@kernel.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