Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1234929 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-09-29 11:50 +0200 |
| Last post | 2015-09-29 17:40 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC][PATCH 05/11] sched: Add preempt argument to __schedule() Peter Zijlstra <peterz@infradead.org> - 2015-09-29 11:50 +0200
Re: [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() Frederic Weisbecker <fweisbec@gmail.com> - 2015-09-29 15:20 +0200
Re: [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() Steven Rostedt <rostedt@goodmis.org> - 2015-09-29 17:30 +0200
Re: [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() Steven Rostedt <rostedt@goodmis.org> - 2015-09-29 17:40 +0200
Re: [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() Peter Zijlstra <peterz@infradead.org> - 2015-09-29 17:40 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-29 11:50 +0200 |
| Subject | [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() |
| Message-ID | <qdZHS-2IS-43@gated-at.bofh.it> |
There is only a single PREEMPT_ACTIVE use in the regular __schedule()
path and that is to circumvent the task->state check. Since the code
setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can
replace this with a function argument.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3045,7 +3045,7 @@ pick_next_task(struct rq *rq, struct tas
*
* WARNING: must be called with preemption disabled!
*/
-static void __sched __schedule(void)
+static void __sched __schedule(bool preempt)
{
struct task_struct *prev, *next;
unsigned long *switch_count;
@@ -3085,7 +3085,7 @@ static void __sched __schedule(void)
rq->clock_skip_update <<= 1; /* promote REQ to ACT */
switch_count = &prev->nivcsw;
- if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
+ if (!preempt && prev->state) {
if (unlikely(signal_pending_state(prev->state, prev))) {
prev->state = TASK_RUNNING;
} else {
@@ -3150,7 +3150,7 @@ asmlinkage __visible void __sched schedu
sched_submit_work(tsk);
do {
preempt_disable();
- __schedule();
+ __schedule(false);
sched_preempt_enable_no_resched();
} while (need_resched());
}
@@ -3191,7 +3191,7 @@ static void __sched notrace preempt_sche
{
do {
preempt_active_enter();
- __schedule();
+ __schedule(true);
preempt_active_exit();
/*
@@ -3256,7 +3256,7 @@ asmlinkage __visible void __sched notrac
* an infinite recursion.
*/
prev_ctx = exception_enter();
- __schedule();
+ __schedule(true);
exception_exit(prev_ctx);
barrier();
@@ -3285,7 +3285,7 @@ asmlinkage __visible void __sched preemp
do {
preempt_active_enter();
local_irq_enable();
- __schedule();
+ __schedule(true);
local_irq_disable();
preempt_active_exit();
} while (need_resched());
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-09-29 15:20 +0200 |
| Message-ID | <qe2Z5-7xW-17@gated-at.bofh.it> |
| In reply to | #1234929 |
On Tue, Sep 29, 2015 at 11:28:30AM +0200, Peter Zijlstra wrote: > There is only a single PREEMPT_ACTIVE use in the regular __schedule() > path and that is to circumvent the task->state check. Since the code > setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can > replace this with a function argument. > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2015-09-29 17:30 +0200 |
| Message-ID | <qe50T-1Za-41@gated-at.bofh.it> |
| In reply to | #1234929 |
On Tue, 29 Sep 2015 11:28:30 +0200 Peter Zijlstra <peterz@infradead.org> wrote: > There is only a single PREEMPT_ACTIVE use in the regular __schedule() > path and that is to circumvent the task->state check. Since the code > setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can > replace this with a function argument. > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- Reviewed-by: Steven Rostedt <rostedt@goodmis.org> -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2015-09-29 17:40 +0200 |
| Message-ID | <qe5aA-2aq-67@gated-at.bofh.it> |
| In reply to | #1235244 |
On Tue, 29 Sep 2015 11:28:39 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > On Tue, 29 Sep 2015 11:28:30 +0200 > Peter Zijlstra <peterz@infradead.org> wrote: > > > There is only a single PREEMPT_ACTIVE use in the regular __schedule() > > path and that is to circumvent the task->state check. Since the code > > setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can > > replace this with a function argument. > > > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > > --- > > Reviewed-by: Steven Rostedt <rostedt@goodmis.org> I just want to note that this scared me at first, because __schedule() can be traced by the function tracer that can also do a preempt_enable() which would schedule if preemption was enabled. But it looks as __schedule() is always called with preemption disabled, thus, no worries. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-29 17:40 +0200 |
| Message-ID | <qe5aA-2aq-69@gated-at.bofh.it> |
| In reply to | #1235300 |
On Tue, Sep 29, 2015 at 11:30:26AM -0400, Steven Rostedt wrote: > On Tue, 29 Sep 2015 11:28:39 -0400 > Steven Rostedt <rostedt@goodmis.org> wrote: > > > On Tue, 29 Sep 2015 11:28:30 +0200 > > Peter Zijlstra <peterz@infradead.org> wrote: > > > > > There is only a single PREEMPT_ACTIVE use in the regular __schedule() > > > path and that is to circumvent the task->state check. Since the code > > > setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can > > > replace this with a function argument. > > > > > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > > > --- > > > > Reviewed-by: Steven Rostedt <rostedt@goodmis.org> > > I just want to note that this scared me at first, because __schedule() > can be traced by the function tracer that can also do a See 11/11 :-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web