When CONFIG_RT_GROUP_SCHED is not configured, group_rt_rq() will
return NULL. With this patch applied, we also can get the same result.
Because the compiler will help us optimize the code.
So, we can remove unnecessary CONFIG_RT_GROUP_SCHED in rt_se_prio().
Signed-off-by: Muchun Song <[email protected]>
---
kernel/sched/rt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a21ea6021929..47b4800761db 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -894,12 +894,10 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
static inline int rt_se_prio(struct sched_rt_entity *rt_se)
{
-#ifdef CONFIG_RT_GROUP_SCHED
struct rt_rq *rt_rq = group_rt_rq(rt_se);
if (rt_rq)
return rt_rq->highest_prio.curr;
-#endif
return rt_task_of(rt_se)->prio;
}
--
2.17.1
Hi Muchun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/sched/core]
[also build test ERROR on v4.19 next-20181030]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Muchun-Song/sched-rt-Remove-unnecessary-CONFIG_RT_GROUP_SCHED-in-rt_se_prio/20181030-225925
config: i386-randconfig-x002-201843 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
kernel/sched/rt.c: In function 'rt_se_prio':
>> kernel/sched/rt.c:900:15: error: 'struct rt_rq' has no member named 'highest_prio'
return rt_rq->highest_prio.curr;
^~
vim +900 kernel/sched/rt.c
ac086bc2 kernel/sched_rt.c Peter Zijlstra 2008-04-19 894
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 895 static inline int rt_se_prio(struct sched_rt_entity *rt_se)
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 896 {
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 897 struct rt_rq *rt_rq = group_rt_rq(rt_se);
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 898
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 899 if (rt_rq)
e864c499 kernel/sched_rt.c Gregory Haskins 2008-12-29 @900 return rt_rq->highest_prio.curr;
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 901
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 902 return rt_task_of(rt_se)->prio;
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 903 }
6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 904
:::::: The code at line 900 was first introduced by commit
:::::: e864c499d9e57805ae1f9e7ea404dd223759cd53 sched: track the next-highest priority on each runqueue
:::::: TO: Gregory Haskins <[email protected]>
:::::: CC: Gregory Haskins <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
I am sorry that I did not consider CONFIG_SMP is also not configured.
In this case, 'struct rt_rq' has no member named 'highest_prio'. So, I
I understand why the code here needs CONFIG_RT_GROUP_SCHED.
When CONFIG_SMP or CONFIG_RT_GROUP_SCHED is configured,
'struct rt_rq' will have member named 'highest_prio'.
So, this patch does't make sense.
kbuild test robot <[email protected]> 于2018年10月30日周二 下午11:14写道:
>
> Hi Muchun,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on tip/sched/core]
> [also build test ERROR on v4.19 next-20181030]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Muchun-Song/sched-rt-Remove-unnecessary-CONFIG_RT_GROUP_SCHED-in-rt_se_prio/20181030-225925
> config: i386-randconfig-x002-201843 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
> kernel/sched/rt.c: In function 'rt_se_prio':
> >> kernel/sched/rt.c:900:15: error: 'struct rt_rq' has no member named 'highest_prio'
> return rt_rq->highest_prio.curr;
> ^~
>
> vim +900 kernel/sched/rt.c
>
> ac086bc2 kernel/sched_rt.c Peter Zijlstra 2008-04-19 894
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 895 static inline int rt_se_prio(struct sched_rt_entity *rt_se)
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 896 {
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 897 struct rt_rq *rt_rq = group_rt_rq(rt_se);
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 898
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 899 if (rt_rq)
> e864c499 kernel/sched_rt.c Gregory Haskins 2008-12-29 @900 return rt_rq->highest_prio.curr;
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 901
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 902 return rt_task_of(rt_se)->prio;
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 903 }
> 6f505b16 kernel/sched_rt.c Peter Zijlstra 2008-01-25 904
>
> :::::: The code at line 900 was first introduced by commit
> :::::: e864c499d9e57805ae1f9e7ea404dd223759cd53 sched: track the next-highest priority on each runqueue
>
> :::::: TO: Gregory Haskins <[email protected]>
> :::::: CC: Gregory Haskins <[email protected]>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation