All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/22] kthread: Use kthread worker API more widely
@ 2015-11-18 13:25 ` Petr Mladek
  0 siblings, 0 replies; 110+ messages in thread
From: Petr Mladek @ 2015-11-18 13:25 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, linux-api, linux-kernel, Petr Mladek,
	Catalin Marinas, linux-watchdog, Corey Minyard,
	openipmi-developer, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma, Maxim Levitsky, Zhang Rui, Eduardo Valentin,
	Jacob Pan

My intention is to make it easier to manipulate and maintain kthreads.
Especially, I want to replace all the custom main cycles with a
generic one. Also I want to make the kthreads sleep in a consistent
state in a common place when there is no work.

My first attempt was with a brand new API (iterant kthread), see
http://thread.gmane.org/gmane.linux.kernel.api/11892 . But I was
directed to improve the existing kthread worker API. This is
the 3rd iteration of the new direction.


1st patch: add support to check if a timer callback is being called

2nd..12th patches: improve the existing kthread worker API

13th..18th, 20th, 22nd patches: convert several kthreads into
      the kthread worker API, namely: khugepaged, ring buffer
      benchmark, hung_task, kmemleak, ipmi, IB/fmr_pool,
      memstick/r592, intel_powerclamp
      
21st, 23rd patches: do some preparation steps; they usually do
      some clean up that makes sense even without the conversion.

  
Changes against v2:

  + used worker->lock to synchronize the operations with the work
    instead of the PENDING bit as suggested by Tejun Heo; it simplified
    the implementation in several ways

  + added timer_active(); used it together with del_timer_sync()
    to cancel the work a less tricky way

  + removed the controversial conversion of the RCU kthreads

  + added several other examples: hung_task, kmemleak, ipmi,
    IB/fmr_pool, memstick/r592, intel_powerclamp

  + the helper fixes for the ring buffer benchmark has been improved
    as suggested by Steven; they already are in the Linus tree now

  + fixed a possible race between the check for existing khugepaged
    worker and queuing the work
 

Changes against v1:

  + remove wrappers to manipulate the scheduling policy and priority

  + remove questionable wakeup_and_destroy_kthread_worker() variant

  + do not check for chained work when draining the queue

  + allocate struct kthread worker in create_kthread_work() and
    use more simple checks for running worker

  + add support for delayed kthread works and use them instead
    of waiting inside the works

  + rework the "unrelated" fixes for the ring buffer benchmark
    as discussed in the 1st RFC; also sent separately

  + convert also the consumer in the ring buffer benchmark


I have tested this patch set against the stable Linus tree
for 4.4-rc1.

Petr Mladek (22):
  timer: Allow to check when the timer callback has not finished yet
  kthread/smpboot: Do not park in kthread_create_on_cpu()
  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: Detect when a kthread work is used by more workers
  kthread: Initial support for delayed kthread work
  kthread: Allow to cancel kthread work
  kthread: Allow to modify delayed kthread work
  kthread: Better support freezable kthread workers
  kthread: Use try_lock_kthread_work() in flush_kthread_work()
  mm/huge_page: Convert khugepaged() into kthread worker API
  ring_buffer: Convert benchmark kthreads into kthread worker API
  hung_task: Convert hungtaskd into kthread worker API
  kmemleak: Convert kmemleak kthread into kthread worker API
  ipmi: Convert kipmi kthread into kthread worker API
  IB/fmr_pool: Convert the cleanup thread into kthread worker API
  memstick/r592: Better synchronize debug messages in r592_io kthread
  memstick/r592: convert r592_io kthread into kthread worker API
  thermal/intel_powerclamp: Remove duplicated code that starts the
    kthread
  thermal/intel_powerclamp: Convert the kthread to kthread worker API

 drivers/char/ipmi/ipmi_si_intf.c     | 116 ++++---
 drivers/infiniband/core/fmr_pool.c   |  54 ++-
 drivers/memstick/host/r592.c         |  61 ++--
 drivers/memstick/host/r592.h         |   5 +-
 drivers/thermal/intel_powerclamp.c   | 302 +++++++++--------
 include/linux/kthread.h              |  56 ++++
 include/linux/timer.h                |   2 +
 kernel/hung_task.c                   |  41 ++-
 kernel/kthread.c                     | 618 +++++++++++++++++++++++++++++++----
 kernel/smpboot.c                     |   5 +
 kernel/time/timer.c                  |  24 ++
 kernel/trace/ring_buffer_benchmark.c | 133 ++++----
 mm/huge_memory.c                     | 134 ++++----
 mm/kmemleak.c                        |  86 +++--
 14 files changed, 1142 insertions(+), 495 deletions(-)

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: linux-watchdog@vger.kernel.org
CC: Corey Minyard <minyard@acm.org>
CC: openipmi-developer@lists.sourceforge.net
CC: Doug Ledford <dledford@redhat.com>
CC: Sean Hefty <sean.hefty@intel.com>
CC: Hal Rosenstock <hal.rosenstock@gmail.com>
CC: linux-rdma@vger.kernel.org
CC: Maxim Levitsky <maximlevitsky@gmail.com>
CC: Zhang Rui <rui.zhang@intel.com>
CC: Eduardo Valentin <edubezval@gmail.com>
CC: Jacob Pan <jacob.jun.pan@linux.intel.com>
CC: linux-pm@vger.kernel.org

-- 
1.8.5.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-01-14 15:38 UTC | newest]

Thread overview: 110+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 13:25 [PATCH v3 00/22] kthread: Use kthread worker API more widely Petr Mladek
2015-11-18 13:25 ` Petr Mladek
2015-11-18 13:25 ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 01/22] timer: Allow to check when the timer callback has not finished yet Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 22:32   ` Thomas Gleixner
2015-11-18 22:32     ` Thomas Gleixner
2015-11-19 12:43     ` Petr Mladek
2015-11-19 12:43       ` Petr Mladek
2015-11-19 12:43       ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 02/22] kthread/smpboot: Do not park in kthread_create_on_cpu() Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-25 21:16   ` Thomas Gleixner
2015-11-25 21:16     ` Thomas Gleixner
2015-11-25 21:16     ` Thomas Gleixner
2015-11-18 13:25 ` [PATCH v3 03/22] kthread: Allow to call __kthread_create_on_node() with va_list args Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 04/22] kthread: Add create_kthread_worker*() Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 05/22] kthread: Add drain_kthread_worker() Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 06/22] kthread: Add destroy_kthread_worker() Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 07/22] kthread: Detect when a kthread work is used by more workers Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-23 22:27   ` Tejun Heo
2015-11-23 22:27     ` Tejun Heo
2015-11-24 10:06     ` Petr Mladek
2015-11-24 10:06       ` Petr Mladek
2015-11-24 10:06       ` Petr Mladek
2015-11-24 14:49       ` Tejun Heo
2015-11-24 14:49         ` Tejun Heo
2015-11-24 16:28         ` Petr Mladek
2015-11-24 16:28           ` Petr Mladek
2015-11-24 14:56       ` Peter Zijlstra
2015-11-24 14:56         ` Peter Zijlstra
2015-11-24 14:56         ` Peter Zijlstra
2015-11-18 13:25 ` [PATCH v3 08/22] kthread: Initial support for delayed kthread work Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 09/22] kthread: Allow to cancel " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-23 22:58   ` Tejun Heo
2015-11-23 22:58     ` Tejun Heo
2015-11-23 22:58     ` Tejun Heo
2015-11-24 10:21     ` Petr Mladek
2015-11-24 10:21       ` Petr Mladek
2015-11-24 20:23     ` Linus Torvalds
2015-11-24 20:23       ` Linus Torvalds
2015-11-24 20:23       ` Linus Torvalds
2015-11-24 20:28       ` Tejun Heo
2015-11-24 20:28         ` Tejun Heo
2015-11-24 20:28         ` Tejun Heo
2015-11-24 20:49         ` Linus Torvalds
2015-11-24 20:49           ` Linus Torvalds
2015-11-18 13:25 ` [PATCH v3 10/22] kthread: Allow to modify delayed " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 11/22] kthread: Better support freezable kthread workers Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 12/22] kthread: Use try_lock_kthread_work() in flush_kthread_work() Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 13/22] mm/huge_page: Convert khugepaged() into kthread worker API Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 14/22] ring_buffer: Convert benchmark kthreads " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 15/22] hung_task: Convert hungtaskd " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 16/22] kmemleak: Convert kmemleak kthread " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 17/22] ipmi: Convert kipmi " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-23 19:36   ` Corey Minyard
2015-11-23 19:36     ` Corey Minyard
2015-11-24 12:12     ` Petr Mladek
2015-11-24 12:12       ` Petr Mladek
2015-11-24 12:12       ` Petr Mladek
2015-11-24 13:30       ` Corey Minyard
2015-11-24 13:30         ` Corey Minyard
2015-11-24 13:30         ` Corey Minyard
2015-11-18 13:25 ` [PATCH v3 18/22] IB/fmr_pool: Convert the cleanup thread " Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-19 12:46   ` Yuval Shaia
2015-11-19 12:46     ` Yuval Shaia
2015-11-18 13:25 ` [PATCH v3 19/22] memstick/r592: Better synchronize debug messages in r592_io kthread Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 20/22] memstick/r592: convert r592_io kthread into kthread worker API Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 21/22] thermal/intel_powerclamp: Remove duplicated code that starts the kthread Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2015-11-18 13:25 ` [PATCH v3 22/22] thermal/intel_powerclamp: Convert the kthread to kthread worker API Petr Mladek
2015-11-18 13:25   ` Petr Mladek
2016-01-07 19:55   ` Jacob Pan
2016-01-07 19:55     ` Jacob Pan
2016-01-08 16:49     ` Petr Mladek
2016-01-08 16:49       ` Petr Mladek
2016-01-12  2:17       ` Jacob Pan
2016-01-12  2:17         ` Jacob Pan
2016-01-12 10:11         ` Petr Mladek
2016-01-12 10:11           ` Petr Mladek
2016-01-12 16:20           ` Jacob Pan
2016-01-12 16:20             ` Jacob Pan
2016-01-13 10:18             ` Petr Mladek
2016-01-13 10:18               ` Petr Mladek
2016-01-13 10:18               ` Petr Mladek
2016-01-13 17:53               ` Jacob Pan
2016-01-13 17:53                 ` Jacob Pan
2016-01-14 15:37                 ` Petr Mladek
2016-01-14 15:37                   ` Petr Mladek
2015-11-18 14:25 ` [PATCH v3 00/22] kthread: Use kthread worker API more widely Paul E. McKenney
2015-11-18 14:25   ` Paul E. McKenney
2015-11-18 14:25   ` Paul E. McKenney

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.