All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/14] kthread: Use kthread worker API more widely
@ 2015-07-28 14:39 ` Petr Mladek
  0 siblings, 0 replies; 86+ messages in thread
From: Petr Mladek @ 2015-07-28 14:39 UTC (permalink / raw)
  To: Andrew Morton, Oleg Nesterov, Tejun Heo, Ingo Molnar, Peter Zijlstra
  Cc: Steven Rostedt, Paul E. McKenney, Josh Triplett, Thomas Gleixner,
	Linus Torvalds, Jiri Kosina, Borislav Petkov, Michal Hocko,
	linux-mm, Vlastimil Babka, live-patching, linux-api,
	linux-kernel, Petr Mladek

Kthreads are currently implemented as an infinite loop. Each
has its own variant of checks for terminating, freezing,
awakening. Sometimes, it is hard to say if they are done
correctly. They are also harder to maintain if there is
a generic problem found in the area.

I have proposed a so-called kthread iterant API to improve the situation,
see https://lkml.org/lkml/2015/6/5/555. The RFC opened and/or answered
several questions.

This RFC is reaction on Tejun's suggestion to use the existing kthread
worker API instead of a new one, see https://lkml.org/lkml/2015/6/9/77.
I wanted to give it a try.


Structure of this patch set:
----------------------------

1st..6th patches: improve the existing kthread worker API

7th, 8th, 11th patches: converts three kthreads into the new API,
     namely: RCU gp kthreas, khugepaged, my favorite ring buffer
     benchmark

12th..14th patches: show how we could further improve the API

9th, 10th patches:  do some further clean up of the ring buffer
     benchmark; they allow easier conversion into the new API;
     but they might be applied independently


TODO:
-----

If people like the kthread worker API, it will need more love.
The following ideas come to my mind:

  + allow to pass void *data via struct kthread_work;
  + hide struct kthread_worker in kthread.c and make the API
    more safe
  + allow to cancel work


I have tested this patches against today's Linux tree, aka 4.2.0-rc4+.

Petr Mladek (14):
  kthread: Allow to call __kthread_create_on_node() with va_list args
  kthread: Add create_kthread_worker*()
  kthread: Add drain_kthread_worker()
  kthread: Add destroy_kthread_worker()
  kthread: Add wakeup_and_destroy_kthread_worker()
  kthread: Add kthread_worker_created()
  mm/huge_page: Convert khugepaged() into kthread worker API
  rcu: Convert RCU gp kthreads into kthread worker API
  ring_buffer: Initialize completions statically in the benchmark
  ring_buffer: Fix more races when terminating the producer in the
    benchmark
  ring_buffer: Use kthread worker API for the producer kthread in the
    benchmark
  kthread_worker: Better support freezable kthread workers
  kthread_worker: Add set_kthread_worker_user_nice()
  kthread_worker: Add set_kthread_worker_scheduler*()

 include/linux/kthread.h              |  29 +++
 kernel/kthread.c                     | 359 +++++++++++++++++++++++++++++++----
 kernel/rcu/tree.c                    | 182 +++++++++---------
 kernel/rcu/tree.h                    |   4 +-
 kernel/trace/ring_buffer_benchmark.c | 150 ++++++++-------
 mm/huge_memory.c                     |  83 ++++----
 6 files changed, 584 insertions(+), 223 deletions(-)

-- 
1.8.5.6


^ permalink raw reply	[flat|nested] 86+ messages in thread

end of thread, other threads:[~2015-09-07 17:52 UTC | newest]

Thread overview: 86+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 14:39 [RFC PATCH 00/14] kthread: Use kthread worker API more widely Petr Mladek
2015-07-28 14:39 ` Petr Mladek
2015-07-28 14:39 ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 01/14] kthread: Allow to call __kthread_create_on_node() with va_list args Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 02/14] kthread: Add create_kthread_worker*() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 03/14] kthread: Add drain_kthread_worker() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:18   ` Tejun Heo
2015-07-28 17:18     ` Tejun Heo
2015-07-28 17:18     ` Tejun Heo
2015-07-29 10:04     ` Petr Mladek
2015-07-29 10:04       ` Petr Mladek
2015-07-29 10:04       ` Petr Mladek
2015-07-29 15:03       ` Tejun Heo
2015-07-29 15:03         ` Tejun Heo
2015-07-29 15:03         ` Tejun Heo
2015-07-28 14:39 ` [RFC PATCH 04/14] kthread: Add destroy_kthread_worker() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 05/14] kthread: Add wakeup_and_destroy_kthread_worker() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:23   ` Tejun Heo
2015-07-28 17:23     ` Tejun Heo
2015-07-28 17:23     ` Tejun Heo
2015-07-28 14:39 ` [RFC PATCH 06/14] kthread: Add kthread_worker_created() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:26   ` Tejun Heo
2015-07-28 17:26     ` Tejun Heo
2015-07-28 17:26     ` Tejun Heo
2015-07-29 10:07     ` Petr Mladek
2015-07-29 10:07       ` Petr Mladek
2015-07-29 10:07       ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 07/14] mm/huge_page: Convert khugepaged() into kthread worker API Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:36   ` Tejun Heo
2015-07-28 17:36     ` Tejun Heo
2015-07-29 11:32     ` Petr Mladek
2015-07-29 11:32       ` Petr Mladek
2015-07-29 11:32       ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 08/14] rcu: Convert RCU gp kthreads " Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:37   ` Tejun Heo
2015-07-28 17:37     ` Tejun Heo
2015-07-28 14:39 ` [RFC PATCH 09/14] ring_buffer: Initialize completions statically in the benchmark Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-08-03 18:31   ` Steven Rostedt
2015-08-03 18:31     ` Steven Rostedt
2015-09-04  9:31     ` Petr Mladek
2015-09-04  9:31       ` Petr Mladek
2015-09-04  9:31       ` Petr Mladek
2015-09-04 13:15       ` Steven Rostedt
2015-09-04 13:15         ` Steven Rostedt
2015-07-28 14:39 ` [RFC PATCH 10/14] ring_buffer: Fix more races when terminating the producer " Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-08-03 18:33   ` Steven Rostedt
2015-08-03 18:33     ` Steven Rostedt
2015-09-04  9:38     ` Petr Mladek
2015-09-04  9:38       ` Petr Mladek
2015-09-04  9:38       ` Petr Mladek
2015-09-07 17:49       ` Oleg Nesterov
2015-09-07 17:49         ` Oleg Nesterov
2015-09-07 17:49         ` Oleg Nesterov
2015-07-28 14:39 ` [RFC PATCH 11/14] ring_buffer: Use kthread worker API for the producer kthread " Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 12/14] kthread_worker: Better support freezable kthread workers Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39 ` [RFC PATCH 13/14] kthread_worker: Add set_kthread_worker_user_nice() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:40   ` Tejun Heo
2015-07-28 17:40     ` Tejun Heo
2015-07-28 17:40     ` Tejun Heo
2015-07-29 11:23     ` Petr Mladek
2015-07-29 11:23       ` Petr Mladek
2015-07-29 11:23       ` Petr Mladek
2015-07-29 15:12       ` Tejun Heo
2015-07-29 15:12         ` Tejun Heo
2015-07-29 15:12         ` Tejun Heo
2015-07-28 14:39 ` [RFC PATCH 14/14] kthread_worker: Add set_kthread_worker_scheduler*() Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 14:39   ` Petr Mladek
2015-07-28 17:41   ` Tejun Heo
2015-07-28 17:41     ` Tejun Heo
2015-07-28 19:48     ` Peter Zijlstra
2015-07-28 19:48       ` Peter Zijlstra
2015-07-28 19:48       ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.