Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1235843 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-09-30 09:40 +0200 |
| Last post | 2015-10-01 15:30 +0200 |
| Articles | 14 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/12] sched: Killing PREEMPT_ACTIVE Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
[PATCH v2 04/12] sched: Add preempt argument to __schedule() Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
[PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
Re: [PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 17:30 +0200
[PATCH v2 08/12] sched: Simplify preempt_count tests Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
Re: [PATCH v2 08/12] sched: Simplify preempt_count tests Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 17:40 +0200
[PATCH v2 12/12] sched: Add preempt_count invariant check Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
Re: [PATCH v2 12/12] sched: Add preempt_count invariant check Steven Rostedt <rostedt@goodmis.org> - 2015-09-30 11:40 +0200
Re: [PATCH v2 12/12] sched: Add preempt_count invariant check Peter Zijlstra <peterz@infradead.org> - 2015-09-30 13:20 +0200
[PATCH v2 11/12] sched: More notrace Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
[PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Steven Rostedt <rostedt@goodmis.org> - 2015-09-30 11:10 +0200
Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 22:50 +0200
Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 15:30 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-30 09:40 +0200 |
| Subject | [PATCH v2 00/12] sched: Killing PREEMPT_ACTIVE |
| Message-ID | <qek9A-6Kx-13@gated-at.bofh.it> |
Second posting of the series that kills PREEMPT_ACTIVE dead. Thanks for all the feedback. I've re-oredered the patches slightly and reworked one or two; those that got significant changes I've ignored the Reviewed-by tags for. Please have another careful look. --- arch/x86/include/asm/preempt.h | 5 +-- arch/x86/include/asm/thread_info.h | 2 - arch/x86/kernel/process_32.c | 8 ---- arch/x86/kernel/process_64.c | 8 ---- include/asm-generic/preempt.h | 2 +- include/linux/preempt.h | 20 +-------- include/linux/sched.h | 26 +++++++----- include/trace/events/sched.h | 22 +++++----- kernel/exit.c | 4 +- kernel/sched/core.c | 83 +++++++++++++++++++++++++------------- kernel/trace/ftrace.c | 2 +- kernel/trace/trace_sched_switch.c | 3 +- kernel/trace/trace_sched_wakeup.c | 2 +- 13 files changed, 89 insertions(+), 98 deletions(-) -- 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 | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-30 09:40 +0200 |
| Subject | [PATCH v2 04/12] sched: Add preempt argument to __schedule() |
| Message-ID | <qek9B-6Kx-49@gated-at.bofh.it> |
| In reply to | #1235843 |
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.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
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
@@ -3037,7 +3037,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;
@@ -3077,7 +3077,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 {
@@ -3142,7 +3142,7 @@ asmlinkage __visible void __sched schedu
sched_submit_work(tsk);
do {
preempt_disable();
- __schedule();
+ __schedule(false);
sched_preempt_enable_no_resched();
} while (need_resched());
}
@@ -3183,7 +3183,7 @@ static void __sched notrace preempt_sche
{
do {
preempt_active_enter();
- __schedule();
+ __schedule(true);
preempt_active_exit();
/*
@@ -3248,7 +3248,7 @@ asmlinkage __visible void __sched notrac
* an infinite recursion.
*/
prev_ctx = exception_enter();
- __schedule();
+ __schedule(true);
exception_exit(prev_ctx);
barrier();
@@ -3277,7 +3277,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] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-30 09:40 +0200 |
| Subject | [PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE |
| Message-ID | <qek9B-6Kx-51@gated-at.bofh.it> |
| In reply to | #1235843 |
Now that nothing tests for PREEMPT_ACTIVE anymore, stop setting it.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/preempt.h | 12 ------------
kernel/sched/core.c | 19 ++++++-------------
2 files changed, 6 insertions(+), 25 deletions(-)
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -146,18 +146,6 @@ extern void preempt_count_sub(int val);
#define preempt_count_inc() preempt_count_add(1)
#define preempt_count_dec() preempt_count_sub(1)
-#define preempt_active_enter() \
-do { \
- preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
- barrier(); \
-} while (0)
-
-#define preempt_active_exit() \
-do { \
- barrier(); \
- preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
-} while (0)
-
#ifdef CONFIG_PREEMPT_COUNT
#define preempt_disable() \
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3190,9 +3190,9 @@ void __sched schedule_preempt_disabled(v
static void __sched notrace preempt_schedule_common(void)
{
do {
- preempt_active_enter();
+ preempt_disable();
__schedule(true);
- preempt_active_exit();
+ sched_preempt_enable_no_resched();
/*
* Check again in case we missed a preemption opportunity
@@ -3243,13 +3243,7 @@ asmlinkage __visible void __sched notrac
return;
do {
- /*
- * Use raw __prempt_count() ops that don't call function.
- * We can't call functions before disabling preemption which
- * disarm preemption tracing recursions.
- */
- __preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET);
- barrier();
+ preempt_disable_notrace();
/*
* Needs preempt disabled in case user_exit() is traced
* and the tracer calls preempt_enable_notrace() causing
@@ -3259,8 +3253,7 @@ asmlinkage __visible void __sched notrac
__schedule(true);
exception_exit(prev_ctx);
- barrier();
- __preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET);
+ preempt_enable_no_resched_notrace();
} while (need_resched());
}
EXPORT_SYMBOL_GPL(preempt_schedule_notrace);
@@ -3283,11 +3276,11 @@ asmlinkage __visible void __sched preemp
prev_state = exception_enter();
do {
- preempt_active_enter();
+ preempt_disable();
local_irq_enable();
__schedule(true);
local_irq_disable();
- preempt_active_exit();
+ sched_preempt_enable_no_resched();
} while (need_resched());
exception_exit(prev_state);
--
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 | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-10-01 17:30 +0200 |
| Subject | Re: [PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE |
| Message-ID | <qeNXY-6n-21@gated-at.bofh.it> |
| In reply to | #1235845 |
On Wed, Sep 30, 2015 at 09:10:41AM +0200, Peter Zijlstra wrote: > Now that nothing tests for PREEMPT_ACTIVE anymore, stop setting it. > > Reviewed-by: Thomas Gleixner <tglx@linutronix.de> > Reviewed-by: Steven Rostedt <rostedt@goodmis.org> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Great news! 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 | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-30 09:40 +0200 |
| Subject | [PATCH v2 08/12] sched: Simplify preempt_count tests |
| Message-ID | <qek9B-6Kx-53@gated-at.bofh.it> |
| In reply to | #1235843 |
Since we stopped setting PREEMPT_ACTIVE, there is no need to mask it
out of preempt_count() tests.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/preempt.h | 3 +--
kernel/sched/core.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -126,8 +126,7 @@
* Check whether we were atomic before we did preempt_disable():
* (used by the scheduler)
*/
-#define in_atomic_preempt_off() \
- ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET)
+#define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET)
#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
extern void preempt_count_add(int val);
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7472,7 +7472,7 @@ void __init sched_init(void)
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
static inline int preempt_count_equals(int preempt_offset)
{
- int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
+ int nested = preempt_count() + rcu_preempt_depth();
return (nested == preempt_offset);
}
--
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 | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-10-01 17:40 +0200 |
| Subject | Re: [PATCH v2 08/12] sched: Simplify preempt_count tests |
| Message-ID | <qeO7D-hB-21@gated-at.bofh.it> |
| In reply to | #1235847 |
On Wed, Sep 30, 2015 at 09:10:43AM +0200, Peter Zijlstra wrote: > Since we stopped setting PREEMPT_ACTIVE, there is no need to mask it > out of preempt_count() tests. > > Reviewed-by: Thomas Gleixner <tglx@linutronix.de> > Reviewed-by: Steven Rostedt <rostedt@goodmis.org> > 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 | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-30 09:40 +0200 |
| Subject | [PATCH v2 12/12] sched: Add preempt_count invariant check |
| Message-ID | <qek9C-6Kx-61@gated-at.bofh.it> |
| In reply to | #1235843 |
Ingo requested I keep my debug check for the preempt_count invariant. Requested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- kernel/sched/core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2514,6 +2514,10 @@ static struct rq *finish_task_switch(str * * Also, see FORK_PREEMPT_COUNT. */ + if (unlikely(WARN_ONCE(preempt_count() != 2*PREEMPT_DISABLE_OFFSET, + "corrupted preempt_count: %s/%d/0x%x\n", + current->comm, current->pid, preempt_count()))) + preempt_count_set(FORK_PREEMPT_COUNT); rq->prev_mm = NULL; -- 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-30 11:40 +0200 |
| Subject | Re: [PATCH v2 12/12] sched: Add preempt_count invariant check |
| Message-ID | <qem1J-Zq-13@gated-at.bofh.it> |
| In reply to | #1235848 |
On Wed, 30 Sep 2015 09:10:47 +0200 Peter Zijlstra <peterz@infradead.org> wrote: > Ingo requested I keep my debug check for the preempt_count invariant. > > Requested-by: Ingo Molnar <mingo@kernel.org> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > kernel/sched/core.c | 4 ++++ > 1 file changed, 4 insertions(+) > > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -2514,6 +2514,10 @@ static struct rq *finish_task_switch(str > * > * Also, see FORK_PREEMPT_COUNT. > */ > + if (unlikely(WARN_ONCE(preempt_count() != 2*PREEMPT_DISABLE_OFFSET, Nuke the "unlikely" it's redundant with the WARN_ONCE(). -- Steve > + "corrupted preempt_count: %s/%d/0x%x\n", > + current->comm, current->pid, preempt_count()))) > + preempt_count_set(FORK_PREEMPT_COUNT); > > rq->prev_mm = NULL; > > -- 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-30 13:20 +0200 |
| Subject | Re: [PATCH v2 12/12] sched: Add preempt_count invariant check |
| Message-ID | <qenAt-3ml-1@gated-at.bofh.it> |
| In reply to | #1235938 |
On Wed, Sep 30, 2015 at 05:38:10AM -0400, Steven Rostedt wrote: > On Wed, 30 Sep 2015 09:10:47 +0200 > Peter Zijlstra <peterz@infradead.org> wrote: > > > Ingo requested I keep my debug check for the preempt_count invariant. > > > > Requested-by: Ingo Molnar <mingo@kernel.org> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > > --- > > kernel/sched/core.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -2514,6 +2514,10 @@ static struct rq *finish_task_switch(str > > * > > * Also, see FORK_PREEMPT_COUNT. > > */ > > + if (unlikely(WARN_ONCE(preempt_count() != 2*PREEMPT_DISABLE_OFFSET, > > Nuke the "unlikely" it's redundant with the WARN_ONCE(). Ah, indeed. *poof* -- 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-30 09:40 +0200 |
| Subject | [PATCH v2 11/12] sched: More notrace |
| Message-ID | <qek9C-6Kx-65@gated-at.bofh.it> |
| In reply to | #1235843 |
preempt_schedule_common() is marked notrace, but it does not use
_notrace() preempt_count functions and __schedule() is also not marked
notrace, which means that its perfectly possible to end up in the
tracer from preempt_schedule_common().
Steve says:
| Yep, there's some history to this. This was originally the issue that
| caused function tracing to go into infinite recursion. But now we have
| preempt_schedule_notrace(), which is used by the function tracer, and
| that function must not be traced till preemption is disabled.
|
| Now if function tracing is running and we take an interrupt when
| NEED_RESCHED is set, it calls
|
| preempt_schedule_common() (not traced)
|
| But then that calls preempt_disable() (traced)
|
| function tracer calls preempt_disable_notrace() followed by
| preempt_enable_notrace() which will see NEED_RESCHED set, and it will
| call preempt_schedule_notrace(), which stops the recursion, but
| still calls __schedule() here, and that means when we return, we call
| the __schedule() from preempt_schedule_common().
|
| That said, I prefer this patch. Preemption is disabled before calling
| __schedule(), and we get rid of a one round recursion with the
| scheduler.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3057,7 +3057,7 @@ pick_next_task(struct rq *rq, struct tas
*
* WARNING: must be called with preemption disabled!
*/
-static void __sched __schedule(bool preempt)
+static void __sched notrace __schedule(bool preempt)
{
struct task_struct *prev, *next;
unsigned long *switch_count;
@@ -3203,9 +3203,9 @@ void __sched schedule_preempt_disabled(v
static void __sched notrace preempt_schedule_common(void)
{
do {
- preempt_disable();
+ preempt_disable_notrace();
__schedule(true);
- sched_preempt_enable_no_resched();
+ preempt_enable_no_resched_notrace();
/*
* Check again in case we missed a preemption opportunity
--
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-30 09:40 +0200 |
| Subject | [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qek9C-6Kx-67@gated-at.bofh.it> |
| In reply to | #1235843 |
As per commit d86ee4809d03 ("sched: optimize cond_resched()") we need
PREEMPT_ACTIVE to avoid cond_resched() from working before the
scheduler is setup.
However, keeping preemption disabled should do the same thing already,
making the PREEMPT_ACTIVE part entirely redundant.
The only complication is !PREEMPT_COUNT kernels, where
PREEMPT_DISABLED ends up being 0. Instead we use an unconditional
PREEMPT_OFFSET to set preempt_count() even on !PREEMPT_COUNT kernels.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/sched.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -606,19 +606,18 @@ struct task_cputime_atomic {
#endif
/*
- * Disable preemption until the scheduler is running.
- * Reset by start_kernel()->sched_init()->init_idle().
+ * Disable preemption until the scheduler is running -- use an unconditional
+ * value so that it also works on !PREEMPT_COUNT kernels.
*
- * We include PREEMPT_ACTIVE to avoid cond_resched() from working
- * before the scheduler is active -- see should_resched().
+ * Reset by start_kernel()->sched_init()->init_idle().
*/
-#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
+#define INIT_PREEMPT_COUNT PREEMPT_OFFSET
/**
* struct thread_group_cputimer - thread group interval timer counts
* @cputime_atomic: atomic thread group interval timers.
* @running: non-zero when there are timers running and
- * @cputime receives updates.
+ * @cputime receives updates.
*
* This structure contains the version of task_cputime, above, that is
* used for thread group CPU timer calculations.
--
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-30 11:10 +0200 |
| Subject | Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qelyG-rL-31@gated-at.bofh.it> |
| In reply to | #1235852 |
On Wed, 30 Sep 2015 09:10:36 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> As per commit d86ee4809d03 ("sched: optimize cond_resched()") we need
> PREEMPT_ACTIVE to avoid cond_resched() from working before the
> scheduler is setup.
>
> However, keeping preemption disabled should do the same thing already,
> making the PREEMPT_ACTIVE part entirely redundant.
>
> The only complication is !PREEMPT_COUNT kernels, where
> PREEMPT_DISABLED ends up being 0. Instead we use an unconditional
> PREEMPT_OFFSET to set preempt_count() even on !PREEMPT_COUNT kernels.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> include/linux/sched.h | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -606,19 +606,18 @@ struct task_cputime_atomic {
> #endif
>
> /*
> - * Disable preemption until the scheduler is running.
> - * Reset by start_kernel()->sched_init()->init_idle().
> + * Disable preemption until the scheduler is running -- use an unconditional
> + * value so that it also works on !PREEMPT_COUNT kernels.
> *
> - * We include PREEMPT_ACTIVE to avoid cond_resched() from working
> - * before the scheduler is active -- see should_resched().
> + * Reset by start_kernel()->sched_init()->init_idle().
Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count().
Other than that.
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
> */
> -#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
> +#define INIT_PREEMPT_COUNT PREEMPT_OFFSET
>
> /**
> * struct thread_group_cputimer - thread group interval timer counts
> * @cputime_atomic: atomic thread group interval timers.
> * @running: non-zero when there are timers running and
> - * @cputime receives updates.
> + * @cputime receives updates.
> *
> * This structure contains the version of task_cputime, above, that is
> * used for thread group CPU timer calculations.
>
--
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 | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-09-30 22:50 +0200 |
| Subject | Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qewu5-7CZ-3@gated-at.bofh.it> |
| In reply to | #1235922 |
On Wed, 30 Sep 2015, Steven Rostedt wrote: > > /* > > - * Disable preemption until the scheduler is running. > > - * Reset by start_kernel()->sched_init()->init_idle(). > > + * Disable preemption until the scheduler is running -- use an unconditional > > + * value so that it also works on !PREEMPT_COUNT kernels. > > * > > - * We include PREEMPT_ACTIVE to avoid cond_resched() from working > > - * before the scheduler is active -- see should_resched(). > > + * Reset by start_kernel()->sched_init()->init_idle(). > > Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count(). > > Other than that. > > Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> -- 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 | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-10-01 15:30 +0200 |
| Subject | Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qeM5P-5zC-1@gated-at.bofh.it> |
| In reply to | #1235852 |
On Wed, Sep 30, 2015 at 09:10:36AM +0200, Peter Zijlstra wrote:
> As per commit d86ee4809d03 ("sched: optimize cond_resched()") we need
> PREEMPT_ACTIVE to avoid cond_resched() from working before the
> scheduler is setup.
>
> However, keeping preemption disabled should do the same thing already,
> making the PREEMPT_ACTIVE part entirely redundant.
>
> The only complication is !PREEMPT_COUNT kernels, where
> PREEMPT_DISABLED ends up being 0. Instead we use an unconditional
> PREEMPT_OFFSET to set preempt_count() even on !PREEMPT_COUNT kernels.
>
> 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] | [standalone]
Back to top | Article view | linux.kernel
csiph-web