Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1668047
| From | ebiederm@xmission.com (Eric W. Biederman) |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v2 1/2] swait: add idle variants which don't contribute to load average |
| Date | 2017-06-16 22:40 +0200 |
| Message-ID | <tT6ca-58r-5@gated-at.bofh.it> (permalink) |
| References | <tSGrn-5cj-11@gated-at.bofh.it> <tSI0a-63s-7@gated-at.bofh.it> <tSI0a-63s-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
"Luis R. Rodriguez" <mcgrof@kernel.org> writes:
> There are cases where folks are using an interruptible swait when
> using kthreads. This is rather confusing given you'd expect
> interruptible waits to be -- interruptible, but kthreads are not
> interruptible ! The reason for such practice though is to avoid
> having these kthreads contribute to the system load average.
>
> When systems are idle some kthreads may spend a lot of time blocking if
> using swait_event_timeout(). This would contribute to the system load
> average. On systems without preemption this would mean the load average
> of an idle system is bumped to 2 instead of 0. On systems with PREEMPT=y
> this would mean the load average of an idle system is bumped to 3
> instead of 0.
>
> This adds proper API using TASK_IDLE to make such goals explicit and
> avoid confusion.
>
> Suggested-by: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
> include/linux/swait.h | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/include/linux/swait.h b/include/linux/swait.h
> index 2c700694d50a..105c70e23286 100644
> --- a/include/linux/swait.h
> +++ b/include/linux/swait.h
> @@ -194,4 +194,29 @@ do { \
> __ret; \
> })
>
> +#define __swait_event_idle(wq, condition) \
> + ___swait_event(wq, condition, TASK_IDLE, 0, schedule())
> +
> +#define swait_event_idle(wq, condition) \
> +({ \
> + int __ret = 0; \
> + if (!(condition)) \
> + __ret = __swait_event_idle(wq, condition); \
> + __ret; \
> +})
The wait isn't interruptible so a return code doesn't make sense here.
> +#define __swait_event_idle_timeout(wq, condition, timeout) \
> + ___swait_event(wq, ___wait_cond_timeout(condition), \
> + TASK_IDLE, timeout, \
> + __ret = schedule_timeout(__ret))
> +
> +#define swait_event_idle_timeout(wq, condition, timeout) \
> +({ \
> + long __ret = timeout; \
> + if (!___wait_cond_timeout(condition)) \
> + __ret = __swait_event_idle_timeout(wq, \
> + condition, timeout); \
> + __ret; \
> +})
> +
> #endif /* _LINUX_SWAIT_H */
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC] rcu: use killable versions of swait "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 01:10 +0200
Re: [RFC] rcu: use killable versions of swait "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-15 01:50 +0200
Re: [RFC] rcu: use killable versions of swait "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 18:00 +0200
Re: [RFC] rcu: use killable versions of swait "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-15 18:30 +0200
Re: [RFC] rcu: use killable versions of swait "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 18:40 +0200
Re: [RFC] rcu: use killable versions of swait ebiederm@xmission.com (Eric W. Biederman) - 2017-06-15 19:10 +0200
[RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 20:50 +0200
[RFC v2 1/2] swait: add idle variants which don't contribute to load average "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 20:50 +0200
Re: [RFC v2 1/2] swait: add idle variants which don't contribute to load average Boqun Feng <boqun.feng@gmail.com> - 2017-06-16 02:50 +0200
Re: [RFC v2 1/2] swait: add idle variants which don't contribute to load average ebiederm@xmission.com (Eric W. Biederman) - 2017-06-16 22:40 +0200
Re: [RFC v2 1/2] swait: add idle variants which don't contribute to load average "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-19 20:00 +0200
[RFC v2 2/2] rcu: use idle versions of swait to make idle-hack clear "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 20:50 +0200
Re: [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-16 00:00 +0200
Re: [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-16 01:30 +0200
Re: [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-16 01:50 +0200
Re: [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit ebiederm@xmission.com (Eric W. Biederman) - 2017-06-16 22:50 +0200
Re: [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-19 20:00 +0200
Re: [RFC] rcu: use killable versions of swait "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-15 19:40 +0200
csiph-web