Messages in this thread | | | Date | Thu, 14 Dec 2023 20:10:57 +0800 | Subject | Re: Re: [PATCH] sched/fair: merge same code in enqueue_task_fair | From | Abel Wu <> |
| |
On 12/14/23 5:47 PM, Wang Jinchao Wrote: > 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%
But TBH this benefit is kind of weak to argue about, given that you don't have any data supporting it.
> > 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 >>
| |