From: Wang Jinchao <wangjinchao@xfusion.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
<linux-kernel@vger.kernel.org>, <stone.xulei@xfusion.com>
Subject: Re: [PATCH] sched/fair: merge same code in enqueue_task_fair
Date: Thu, 14 Dec 2023 17:47:57 +0800 [thread overview]
Message-ID: <ZXrPTbXEyBlT+RgP@fedora> (raw)
In-Reply-To: <CAKfTPtDCSQg_Nwh5osRVL0TEzvNZjrUmg_KsVmJySjV_XnOHzw@mail.gmail.com>
On Wed, Dec 13, 2023 at 09:23:46AM +0100, Vincent Guittot wrote:
> On Wed, 13 Dec 2023 at 08:04, Wang Jinchao <wangjinchao@xfusion.com> wrote:
> >
> > On Mon, Dec 11, 2023 at 04:23:52PM +0100, Vincent Guittot wrote:
> > > On Sun, 10 Dec 2023 at 10:22, WangJinchao <wangjinchao@xfusion.com> wrote:
> > > >
> > > > 1. The code below is duplicated in two for loops and need to be
> > > > consolidated
> > > > 2. Fix the bug where a se's on_rq is true but its parent is not
> > >
> > > Could you clarify which bug you want to fix ?
> > Taking into account the additional information provided by Tim,
> > this is not a bug. Therefore, this patch is merely a logical
> > simplification.
>
> If there is no bug why changing it ?
For two reasons:
1. (from Abel Wu)
It doesn't need to, but it can actually bring some benefit from
the point of view of text size, especially in warehouse-scale
computers where icache is extremely contended.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-56 (-56)
Function old new delta
enqueue_task_fair 936 880 -56
Total: Before=64899, After=64843, chg -0.09%
2. For better code comprehension
I became curious when I reached this part, wondering why there is a lot of
repetition inside these two for-loops. Then I thought about 'do not repeat yourself,'
and I feel that merging them would lead to a clearer understanding. Of course,
it might be because I am just starting to read scheduler-related code and am not
yet familiar with the entire logic.
>
> The duplication is done in order to have the same pattern in :
> enqueue_task_fair
> dequeue_task_fair
> throttle_cfs_rq
> unthrottle_cfs_rq
Due to the two points mentioned above, do we need to adjust all four functions?
>
> so there is no need to change it
I plan to get familiar with the scheduler-related code first and then consider this.
Thanks
>
next prev parent reply other threads:[~2023-12-14 9:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 9:21 [PATCH] sched/fair: merge same code in enqueue_task_fair WangJinchao
2023-12-11 15:23 ` Vincent Guittot
2023-12-13 7:03 ` Wang Jinchao
2023-12-13 8:23 ` Vincent Guittot
2023-12-14 9:47 ` Wang Jinchao [this message]
2023-12-14 12:10 ` Abel Wu
2023-12-14 12:42 ` Wang Jinchao
2023-12-11 22:22 ` Tim Chen
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=ZXrPTbXEyBlT+RgP@fedora \
--to=wangjinchao@xfusion.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=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stone.xulei@xfusion.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@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 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.