Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1489293 > unrolled thread
| Started by | Mikulas Patocka <mpatocka@redhat.com> |
|---|---|
| First post | 2016-09-22 20:30 +0200 |
| Last post | 2016-09-23 16:50 +0200 |
| Articles | 6 — 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.
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y Mikulas Patocka <mpatocka@redhat.com> - 2016-09-22 20:30 +0200
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-09-22 20:40 +0200
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y Peter Zijlstra <peterz@infradead.org> - 2016-09-22 20:50 +0200
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-09-22 22:30 +0200
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y Peter Zijlstra <peterz@infradead.org> - 2016-09-23 10:50 +0200
Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-09-23 16:50 +0200
| From | Mikulas Patocka <mpatocka@redhat.com> |
|---|---|
| Date | 2016-09-22 20:30 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skgUV-1qI-11@gated-at.bofh.it> |
I've found a document that says that cond_resched() is needed on
preemptible kernels to mark RCU quiescent states:
https://lwn.net/Articles/603252/
Paul, is cond_resched() still needed on current RCU implementation? Or not?
Mikulas
On Thu, 22 Sep 2016, tip-bot for Peter Zijlstra wrote:
> Commit-ID: 35a773a07926a22bf19d77ee00024522279c4e68
> Gitweb: http://git.kernel.org/tip/35a773a07926a22bf19d77ee00024522279c4e68
> Author: Peter Zijlstra <peterz@infradead.org>
> AuthorDate: Mon, 19 Sep 2016 12:57:53 +0200
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitDate: Thu, 22 Sep 2016 14:53:46 +0200
>
> sched/core: Avoid _cond_resched() for PREEMPT=y
>
> On fully preemptible kernels _cond_resched() is pointless, so avoid
> emitting any code for it.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
> include/linux/sched.h | 4 ++++
> kernel/sched/core.c | 2 ++
> 2 files changed, 6 insertions(+)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index f00ee8e..b99fcd1 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -3209,7 +3209,11 @@ static inline int signal_pending_state(long state, struct task_struct *p)
> * cond_resched_lock() will drop the spinlock before scheduling,
> * cond_resched_softirq() will enable bhs before scheduling.
> */
> +#ifndef CONFIG_PREEMPT
> extern int _cond_resched(void);
> +#else
> +static inline int _cond_resched(void) { return 0; }
> +#endif
>
> #define cond_resched() ({ \
> ___might_sleep(__FILE__, __LINE__, 0); \
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b2ec53c..d7babcc 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4883,6 +4883,7 @@ SYSCALL_DEFINE0(sched_yield)
> return 0;
> }
>
> +#ifndef CONFIG_PREEMPT
> int __sched _cond_resched(void)
> {
> if (should_resched(0)) {
> @@ -4892,6 +4893,7 @@ int __sched _cond_resched(void)
> return 0;
> }
> EXPORT_SYMBOL(_cond_resched);
> +#endif
>
> /*
> * __cond_resched_lock() - if a reschedule is pending, drop the given lock,
>
[toc] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-09-22 20:40 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skh4C-1rX-53@gated-at.bofh.it> |
| In reply to | #1489293 |
On Thu, Sep 22, 2016 at 02:25:01PM -0400, Mikulas Patocka wrote:
> I've found a document that says that cond_resched() is needed on
> preemptible kernels to mark RCU quiescent states:
>
> https://lwn.net/Articles/603252/
>
> Paul, is cond_resched() still needed on current RCU implementation? Or not?
It can be if you loop in the kernel for a very long time.
But cond_resched_rcu_qs() is instead needed in cases where there is only
one runnable non-idle non-nohz task on a given CPU.
Thanx, Paul
> Mikulas
>
>
>
> On Thu, 22 Sep 2016, tip-bot for Peter Zijlstra wrote:
>
> > Commit-ID: 35a773a07926a22bf19d77ee00024522279c4e68
> > Gitweb: http://git.kernel.org/tip/35a773a07926a22bf19d77ee00024522279c4e68
> > Author: Peter Zijlstra <peterz@infradead.org>
> > AuthorDate: Mon, 19 Sep 2016 12:57:53 +0200
> > Committer: Ingo Molnar <mingo@kernel.org>
> > CommitDate: Thu, 22 Sep 2016 14:53:46 +0200
> >
> > sched/core: Avoid _cond_resched() for PREEMPT=y
> >
> > On fully preemptible kernels _cond_resched() is pointless, so avoid
> > emitting any code for it.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Mikulas Patocka <mpatocka@redhat.com>
> > Cc: Oleg Nesterov <oleg@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> > include/linux/sched.h | 4 ++++
> > kernel/sched/core.c | 2 ++
> > 2 files changed, 6 insertions(+)
> >
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index f00ee8e..b99fcd1 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -3209,7 +3209,11 @@ static inline int signal_pending_state(long state, struct task_struct *p)
> > * cond_resched_lock() will drop the spinlock before scheduling,
> > * cond_resched_softirq() will enable bhs before scheduling.
> > */
> > +#ifndef CONFIG_PREEMPT
> > extern int _cond_resched(void);
> > +#else
> > +static inline int _cond_resched(void) { return 0; }
> > +#endif
> >
> > #define cond_resched() ({ \
> > ___might_sleep(__FILE__, __LINE__, 0); \
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index b2ec53c..d7babcc 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -4883,6 +4883,7 @@ SYSCALL_DEFINE0(sched_yield)
> > return 0;
> > }
> >
> > +#ifndef CONFIG_PREEMPT
> > int __sched _cond_resched(void)
> > {
> > if (should_resched(0)) {
> > @@ -4892,6 +4893,7 @@ int __sched _cond_resched(void)
> > return 0;
> > }
> > EXPORT_SYMBOL(_cond_resched);
> > +#endif
> >
> > /*
> > * __cond_resched_lock() - if a reschedule is pending, drop the given lock,
> >
>
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-09-22 20:50 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skhei-1xN-35@gated-at.bofh.it> |
| In reply to | #1489293 |
On Thu, Sep 22, 2016 at 02:25:01PM -0400, Mikulas Patocka wrote:
> I've found a document that says that cond_resched() is needed on
> preemptible kernels to mark RCU quiescent states:
>
> https://lwn.net/Articles/603252/
>
> Paul, is cond_resched() still needed on current RCU implementation? Or not?
No, we ripped that out. See 4a81e8328d37 ("rcu: Reduce overhead of
cond_resched() checks for RCU")
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-09-22 22:30 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skiN3-2zX-23@gated-at.bofh.it> |
| In reply to | #1489369 |
On Thu, Sep 22, 2016 at 08:42:28PM +0200, Peter Zijlstra wrote:
> On Thu, Sep 22, 2016 at 02:25:01PM -0400, Mikulas Patocka wrote:
> > I've found a document that says that cond_resched() is needed on
> > preemptible kernels to mark RCU quiescent states:
> >
> > https://lwn.net/Articles/603252/
> >
> > Paul, is cond_resched() still needed on current RCU implementation? Or not?
>
> No, we ripped that out. See 4a81e8328d37 ("rcu: Reduce overhead of
> cond_resched() checks for RCU")
I would instead say that we changed the algorithm to reduce the overhead
in the common case, but yes, this commit did change things quite a bit.
Thanx, Paul
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-09-23 10:50 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skulc-1p5-3@gated-at.bofh.it> |
| In reply to | #1489523 |
On Thu, Sep 22, 2016 at 01:28:17PM -0700, Paul E. McKenney wrote:
> On Thu, Sep 22, 2016 at 08:42:28PM +0200, Peter Zijlstra wrote:
> > On Thu, Sep 22, 2016 at 02:25:01PM -0400, Mikulas Patocka wrote:
> > > I've found a document that says that cond_resched() is needed on
> > > preemptible kernels to mark RCU quiescent states:
> > >
> > > https://lwn.net/Articles/603252/
> > >
> > > Paul, is cond_resched() still needed on current RCU implementation? Or not?
> >
> > No, we ripped that out. See 4a81e8328d37 ("rcu: Reduce overhead of
> > cond_resched() checks for RCU")
>
> I would instead say that we changed the algorithm to reduce the overhead
> in the common case, but yes, this commit did change things quite a bit.
Sure, but critical point (for this discussion) is that cond_resched() no
longer implies anything RCU, it really only is a voluntary reschedule
point.
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-09-23 16:50 +0200 |
| Subject | Re: [tip:sched/core] sched/core: Avoid _cond_resched() for PREEMPT=y |
| Message-ID | <skzXz-53e-15@gated-at.bofh.it> |
| In reply to | #1489850 |
On Fri, Sep 23, 2016 at 10:44:42AM +0200, Peter Zijlstra wrote:
> On Thu, Sep 22, 2016 at 01:28:17PM -0700, Paul E. McKenney wrote:
> > On Thu, Sep 22, 2016 at 08:42:28PM +0200, Peter Zijlstra wrote:
> > > On Thu, Sep 22, 2016 at 02:25:01PM -0400, Mikulas Patocka wrote:
> > > > I've found a document that says that cond_resched() is needed on
> > > > preemptible kernels to mark RCU quiescent states:
> > > >
> > > > https://lwn.net/Articles/603252/
> > > >
> > > > Paul, is cond_resched() still needed on current RCU implementation? Or not?
> > >
> > > No, we ripped that out. See 4a81e8328d37 ("rcu: Reduce overhead of
> > > cond_resched() checks for RCU")
> >
> > I would instead say that we changed the algorithm to reduce the overhead
> > in the common case, but yes, this commit did change things quite a bit.
>
> Sure, but critical point (for this discussion) is that cond_resched() no
> longer implies anything RCU, it really only is a voluntary reschedule
> point.
Agreed, cond_resched_rcu_qs() is what you use to do both a cond_resched()
and an RCU quiescent state.
Thanx, Paul
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web