sched: Make sched_feat_names const
PATCH 1/3 sched: Make sched_feat_names const
From: Hiroshi Shimamoto <[email protected]>
The strings sched_feat_names are never changed.
--- kernel/sched/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
@@ -142,7 +142,7 @@ const_debug unsigned int sysctl_sched_features =#define SCHED_FEAT (name, enabled) \ #name , -static __read_mostly char *sched_feat_names[] = { +static const char *const sched_feat_names[] = { #include "features.h"NULL };
Signature · 1 line
1.7.7.6
PATCH 2/3 sched: Remove the last NULL entry from sched_feat_names
From: Hiroshi Shimamoto <[email protected]>
No need to have the last NULL entry.
--- kernel/sched/core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/sched/core.c +0 -1
@@ -144,7 +144,6 @@ const_debug unsigned int sysctl_sched_features =static const char *const sched_feat_names[] = { #include "features.h" -NULL };#undef SCHED_FEAT
Signature · 1 line
1.7.7.6
[tip:sched/urgent] sched: Remove the last NULL entry from sched_feat_names
Commit-ID: 7997a456ef841bb78eb6f881d7cc2c17c2f9b35e Gitweb: http://git.kernel.org/tip/7997a456ef841bb78eb6f881d7cc2c17c2f9b35e Author: Hiroshi Shimamoto <[email protected]> AuthorDate: Fri, 25 May 2012 15:42:47 +0900 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 30 May 2012 14:02:27 +0200
sched: Remove the last NULL entry from sched_feat_names
No need to have the last NULL entry.
--- kernel/sched/core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/sched/core.c +0 -1
@@ -144,7 +144,6 @@ const_debug unsigned int sysctl_sched_features =static const char *const sched_feat_names[] = { #include "features.h" -NULL };#undef SCHED_FEAT
PATCH 3/3 sched/rt: Remove redundant check before push_rt_task()
In reply to Hiroshi ShimamotoFrom: Hiroshi Shimamoto <[email protected]>
Currently rq->rt.overloaded is checked twice in switched_to_rt(). Remove the first one which out of push_rt_task().
--- kernel/sched/rt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/rt.c +1 -1
@@ -1907,7 +1907,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)*/ if (p->on_rq && rq->curr != p) {#ifdef CONFIG_SMP -if (rq->rt.overloaded &&push_rt_task (rq) && +if (push_rt_task (rq) &&/* Don't resched if we changed runqueues */ rq !=task_rq (p)) check_resched =0 ;
Signature · 1 line
1.7.7.6
Re: [PATCH 3/3] sched/rt: Remove redundant check before push_rt_task()
Quoted 4 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
Currently
rq->rt.overloadedis checked twice inswitched_to_rt(). Remove the first one which out ofpush_rt_task().
Steven was this on purpose to avoid the call or can I apply this thing?
Quoted 18 lines
Signed-off-by Hiroshi Shimamoto <[email protected]>--- kernel/sched/rt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/rt.c +1
-1@@ -1907,7 +1907,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)*/ if (p->on_rq && rq->curr != p) {#ifdef CONFIG_SMP -if (rq->rt.overloaded &&push_rt_task (rq) && +if (push_rt_task (rq) &&/* Don't resched if we changed runqueues */ rq !=task_rq (p)) check_resched =0 ;
Steven Rostedt
reviewerRe: [PATCH 3/3] sched/rt: Remove redundant check before push_rt_task()
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
Currently
rq->rt.overloadedis checked twice inswitched_to_rt(). Remove the first one which out ofpush_rt_task().Steven was this on purpose to avoid the call or can I apply this thing?
Yeah, I think I added that as a way to avoid the call, but I never did any benchmarks to see if it was actually better (extra check to avoid the call, or just do the call and remove the duplicate check).
It would be a good idea to see how ofter that check happens in the real world. As two or more RT tasks on the same CPU is only something that happens on a real RT system (as the common case that is).
It's a micro optimization, as a double duplicate check should be fast as everything is nicely in the cache line. But an extra call may be expensive. But it's not a big difference to me if you take the patch or not.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Hiroshi Shimamoto <[email protected]>--- kernel/sched/rt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 12 lines
kernel/sched/rt.c static void switched_to_rt(struct rq *rq, struct task_struct *p) · line 1912
Quoted 12 lines
kernel/sched/rt.c +1
-1@@ -1907,7 +1907,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)*/ if (p->on_rq && rq->curr != p) {#ifdef CONFIG_SMP -if (rq->rt.overloaded &&push_rt_task (rq) && +if (push_rt_task (rq) &&/* Don't resched if we changed runqueues */ rq !=task_rq (p))
If you decide to take this patch, it may be better to switch it to:
/* Don't resched if we changed runqueues */ if (push_rt_task(rq) && rq != task_rq(p))
-- Steve
Quoted 3 lines
Quoted 1 line
kernel/sched/rt.c +0
-0check_resched =0 ;
Commit-ID: 1292531f6f27af909e713671dd9cc3bcab8114b7 Gitweb: http://git.kernel.org/tip/1292531f6f27af909e713671dd9cc3bcab8114b7 Author: Hiroshi Shimamoto <[email protected]> AuthorDate: Fri, 25 May 2012 15:41:54 +0900 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 30 May 2012 14:02:26 +0200
sched: Make sched_feat_names const
The strings sched_feat_names are never changed.
--- kernel/sched/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
@@ -142,7 +142,7 @@ const_debug unsigned int sysctl_sched_features =#define SCHED_FEAT (name, enabled) \ #name , -static __read_mostly char *sched_feat_names[] = { +static const char *const sched_feat_names[] = { #include "features.h"NULL };