Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1234925 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-09-29 11:50 +0200 |
| Last post | 2015-09-29 17:20 +0200 |
| Articles | 7 — 4 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 01/11] sched: Simplify INIT_PREEMPT_COUNT Peter Zijlstra <peterz@infradead.org> - 2015-09-29 11:50 +0200
[tip:sched/core] sched/core: Simplify INIT_PREEMPT_COUNT tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2015-09-29 12:40 +0200
Re: [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT Frederic Weisbecker <fweisbec@gmail.com> - 2015-09-29 15:30 +0200
Re: [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT Steven Rostedt <rostedt@goodmis.org> - 2015-09-29 16:50 +0200
Re: [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT Peter Zijlstra <peterz@infradead.org> - 2015-09-29 17:00 +0200
Re: [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT Steven Rostedt <rostedt@goodmis.org> - 2015-09-29 17:10 +0200
Re: [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT Peter Zijlstra <peterz@infradead.org> - 2015-09-29 17:20 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-29 11:50 +0200 |
| Subject | [RFC][PATCH 01/11] sched: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qdZHQ-2IS-15@gated-at.bofh.it> |
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.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/sched.h | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -608,17 +608,14 @@ struct task_cputime_atomic {
/*
* Disable preemption until the scheduler is running.
* Reset by start_kernel()->sched_init()->init_idle().
- *
- * We include PREEMPT_ACTIVE to avoid cond_resched() from working
- * before the scheduler is active -- see should_resched().
*/
-#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
+#define INIT_PREEMPT_COUNT PREEMPT_DISABLED
/**
* 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] | [next] | [standalone]
| From | tip-bot for Peter Zijlstra <tipbot@zytor.com> |
|---|---|
| Date | 2015-09-29 12:40 +0200 |
| Subject | [tip:sched/core] sched/core: Simplify INIT_PREEMPT_COUNT |
| Message-ID | <qe0ud-3SL-9@gated-at.bofh.it> |
| In reply to | #1234925 |
Commit-ID: aed586c2f11e5cddd52c180ccde651d0d35b736b
Gitweb: http://git.kernel.org/tip/aed586c2f11e5cddd52c180ccde651d0d35b736b
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 29 Sep 2015 11:28:26 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 29 Sep 2015 12:27:39 +0200
sched/core: Simplify INIT_PREEMPT_COUNT
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.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org
Cc: oleg@redhat.com
Cc: rostedt@goodmis.org
Cc: umgwanakikbuti@gmail.com
Link: http://lkml.kernel.org/r/20150929093519.706413197@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/sched.h | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 699228b..5ef9e2c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -608,17 +608,14 @@ struct task_cputime_atomic {
/*
* Disable preemption until the scheduler is running.
* Reset by start_kernel()->sched_init()->init_idle().
- *
- * We include PREEMPT_ACTIVE to avoid cond_resched() from working
- * before the scheduler is active -- see should_resched().
*/
-#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
+#define INIT_PREEMPT_COUNT PREEMPT_DISABLED
/**
* 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 | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-09-29 15:30 +0200 |
| Message-ID | <qe38J-7J7-3@gated-at.bofh.it> |
| In reply to | #1234925 |
On Tue, Sep 29, 2015 at 11:28:26AM +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.
>
> 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 16:50 +0200 |
| Message-ID | <qe4ob-ZN-43@gated-at.bofh.it> |
| In reply to | #1234925 |
[ Resend with a "Reply-all" this time! ]
On Tue, 29 Sep 2015 11:28:26 +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.
Thus PREEMPT_ACTIVE wasn't needed at that commit either, or was it?
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> include/linux/sched.h | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -608,17 +608,14 @@ struct task_cputime_atomic {
> /*
> * Disable preemption until the scheduler is running.
> * Reset by start_kernel()->sched_init()->init_idle().
> - *
> - * We include PREEMPT_ACTIVE to avoid cond_resched() from working
> - * before the scheduler is active -- see should_resched().
> */
> -#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
> +#define INIT_PREEMPT_COUNT PREEMPT_DISABLED
I can't find anything wrong with this.
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
>
> /**
> * 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 | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-29 17:00 +0200 |
| Message-ID | <qe4xQ-1b4-23@gated-at.bofh.it> |
| In reply to | #1235186 |
On Tue, Sep 29, 2015 at 10:43:32AM -0400, Steven Rostedt wrote:
>
> [ Resend with a "Reply-all" this time! ]
>
> On Tue, 29 Sep 2015 11:28:26 +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.
>
> Thus PREEMPT_ACTIVE wasn't needed at that commit either, or was it?
Correct. We might have actually discussed that at that time but decided
to be conservative -- but these be vague memories..
--
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:10 +0200 |
| Message-ID | <qe4Hw-1BQ-9@gated-at.bofh.it> |
| In reply to | #1234925 |
[ Resend, with the Cc list back ]
On Tue, 29 Sep 2015 16:35:59 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Sep 29, 2015 at 10:37:29AM -0400, Steven Rostedt wrote:
> > On Tue, 29 Sep 2015 11:28:26 +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.
> >
> > Thus PREEMPT_ACTIVE wasn't needed at that commit either, or was it?
>
> Correct. We might have actually discussed that at that time but decided
> to be conservative -- but these be vague memories..
Hmm, I just looked closer and I'm wondering if this still works?
We have:
#ifdef CONFIG_PREEMPT_COUNT
#define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
#else
#define PREEMPT_DISABLED PREEMPT_ENABLED
#endif
Now if we just remove the PREEMPT_ACTIVE from the INIT_PREEMPT_COUNT,
when CONFIG_PREEMPT_COUNT is not set, wouldn't a _cond_resched() in
boot up schedule?
-- 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:20 +0200 |
| Message-ID | <qe4Rc-1Nk-35@gated-at.bofh.it> |
| In reply to | #1235206 |
On Tue, Sep 29, 2015 at 11:00:49AM -0400, Steven Rostedt wrote: > > [ Resend, with the Cc list back ] You seem to have a hard time with these buttons today ;-) > Hmm, I just looked closer and I'm wondering if this still works? > > We have: > > #ifdef CONFIG_PREEMPT_COUNT > #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) > #else > #define PREEMPT_DISABLED PREEMPT_ENABLED > #endif > > Now if we just remove the PREEMPT_ACTIVE from the INIT_PREEMPT_COUNT, > when CONFIG_PREEMPT_COUNT is not set, wouldn't a _cond_resched() in > boot up schedule? Good point, PREEMPT_COUNT isn't required for voluntary preemption; when I tested the voluntary build nothing bad happened, but that could have been luck of course. So what we can do is use an unconditional 1 for INIT_PREEMPT_COUNT, such that the init task will have a raised preempt_count() during boot, even on !PREEMPT_COUNT kernels. But that means we cannot use INIT_PREEMPT_COUNT for init_task_preempt_count() and such like, as I wanted to. I'll make FORK_PREEMPT_COUNT for that instead. -- 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