public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
@ 2024-09-18 15:23 Steven Davis
  2024-09-19 13:54 ` Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Steven Davis @ 2024-09-18 15:23 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Steven Davis

Add cond_resched() to the busy-wait loop in irq_work_sync to improve
CPU responsiveness and prevent starvation of other tasks.

Previously, the busy-wait loop used cpu_relax() alone, which, while
reducing power consumption, could still lead to excessive CPU
monopolization in scenarios where IRQ work remains busy for extended
periods. By incorporating cond_resched(), the CPU is periodically yielded
to the scheduler, allowing other tasks to execute and enhancing overall
system responsiveness.

Signed-off-by: Steven Davis <goldside000@outlook.com>
---
 kernel/irq_work.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index 2f4fb336dda1..bdc478979ee6 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -295,9 +295,17 @@ void irq_work_sync(struct irq_work *work)
 		return;
 	}
 
-	while (irq_work_is_busy(work))
+	int retry_count = 0;
+
+	while (irq_work_is_busy(work)) {
 		cpu_relax();
+
+	if (retry_count++ > 1000) {
+		cond_resched();
+		retry_count = 0;
+	}
 }
+
 EXPORT_SYMBOL_GPL(irq_work_sync);
 
 static void run_irq_workd(unsigned int cpu)
-- 
2.39.5


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

* Re: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
  2024-09-18 15:23 [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched() Steven Davis
@ 2024-09-19 13:54 ` Thomas Gleixner
  2024-09-19 15:25   ` Steven Davis
  2024-09-21 14:42 ` kernel test robot
  2024-09-21 15:13 ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2024-09-19 13:54 UTC (permalink / raw)
  To: Steven Davis, akpm
  Cc: linux-kernel, Steven Davis, Peter Zijlstra, Ankur Arora,
	Frederic Weisbecker

On Wed, Sep 18 2024 at 11:23, Steven Davis wrote:
> Add cond_resched() to the busy-wait loop in irq_work_sync to improve
> CPU responsiveness and prevent starvation of other tasks.
>
> Previously, the busy-wait loop used cpu_relax() alone, which, while
> reducing power consumption, could still lead to excessive CPU
> monopolization in scenarios where IRQ work remains busy for extended
> periods. By incorporating cond_resched(), the CPU is periodically yielded
> to the scheduler, allowing other tasks to execute and enhancing overall
> system responsiveness.
>  
> -	while (irq_work_is_busy(work))
> +	int retry_count = 0;
> +
> +	while (irq_work_is_busy(work)) {
>  		cpu_relax();
> +
> +	if (retry_count++ > 1000) {
> +		cond_resched();
> +		retry_count = 0;
> +	}

Did you verify that all callers are actually calling from preemptible
context?

If so, then we should just get rid of the loop waiting completely and
use the rcu_wait mechanism which RT uses.

Thanks,

        tglx

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

* Re: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
  2024-09-19 13:54 ` Thomas Gleixner
@ 2024-09-19 15:25   ` Steven Davis
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Davis @ 2024-09-19 15:25 UTC (permalink / raw)
  To: tglx; +Cc: akpm, ankur.a.arora, frederic, goldside000, linux-kernel, peterz

On Thu, 19 Sep 2024 at 15:54:21 +0200, Thomas Gleixner wrote:
> On Wed, Sep 18 2024 at 11:23, Steven Davis wrote:
>> Add cond_resched() to the busy-wait loop in irq_work_sync to improve
>> CPU responsiveness and prevent starvation of other tasks.
>>
>> Previously, the busy-wait loop used cpu_relax() alone, which, while
>> reducing power consumption, could still lead to excessive CPU
>> monopolization in scenarios where IRQ work remains busy for extended
>> periods. By incorporating cond_resched(), the CPU is periodically yielded
>> to the scheduler, allowing other tasks to execute and enhancing overall
>> system responsiveness.
>> 
>> -	while (irq_work_is_busy(work))
>> +	int retry_count = 0;
>> +
>> +	while (irq_work_is_busy(work)) {
>>  		cpu_relax();
>> +
>> +	if (retry_count++ > 1000) {
>> +		cond_resched();
>> +		retry_count = 0;
>> +	}
>
> Did you verify that all callers are actually calling from preemptible
> context?

Yes, I reviewed the 11 calls to irq_work_sync, and they all seem to 
occur in preemptible contexts.

> If so, then we should just get rid of the loop waiting completely and
> use the rcu_wait mechanism which RT uses.

Will do that soon. Thanks for the suggestion.

	Steven

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

* Re: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
  2024-09-18 15:23 [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched() Steven Davis
  2024-09-19 13:54 ` Thomas Gleixner
@ 2024-09-21 14:42 ` kernel test robot
  2024-09-21 15:13 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-09-21 14:42 UTC (permalink / raw)
  To: Steven Davis, akpm; +Cc: oe-kbuild-all, linux-kernel, Steven Davis

Hi Steven,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v6.11 next-20240920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Steven-Davis/irq_work-Improve-CPU-Responsiveness-in-irq_work_sync-with-cond_resched/20240918-232606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/SJ2P223MB10263844181902531B671FB6F7622%40SJ2P223MB1026.NAMP223.PROD.OUTLOOK.COM
patch subject: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
config: parisc-allnoconfig (https://download.01.org/0day-ci/archive/20240921/202409212211.Lopmt0MK-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240921/202409212211.Lopmt0MK-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409212211.Lopmt0MK-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/irq_work.c: In function 'irq_work_sync':
>> kernel/irq_work.c:311:13: error: invalid storage class for function 'run_irq_workd'
     311 | static void run_irq_workd(unsigned int cpu)
         |             ^~~~~~~~~~~~~
>> kernel/irq_work.c:316:13: error: invalid storage class for function 'irq_workd_setup'
     316 | static void irq_workd_setup(unsigned int cpu)
         |             ^~~~~~~~~~~~~~~
>> kernel/irq_work.c:323:35: error: initializer element is not constant
     323 |         .setup                  = irq_workd_setup,
         |                                   ^~~~~~~~~~~~~~~
   kernel/irq_work.c:323:35: note: (near initialization for 'irqwork_threads.setup')
   kernel/irq_work.c:325:35: error: initializer element is not constant
     325 |         .thread_fn              = run_irq_workd,
         |                                   ^~~~~~~~~~~~~
   kernel/irq_work.c:325:35: note: (near initialization for 'irqwork_threads.thread_fn')
>> kernel/irq_work.c:329:19: error: invalid storage class for function 'irq_work_init_threads'
     329 | static __init int irq_work_init_threads(void)
         |                   ^~~~~~~~~~~~~~~~~~~~~
   In file included from arch/parisc/include/asm/alternative.h:18,
                    from arch/parisc/include/asm/barrier.h:5,
                    from include/asm-generic/bitops/generic-non-atomic.h:7,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:23,
                    from arch/parisc/include/asm/bug.h:5,
                    from include/linux/bug.h:5,
                    from kernel/irq_work.c:9:
   kernel/irq_work.c:335:16: error: initializer element is not constant
     335 | early_initcall(irq_work_init_threads);
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/linux/init.h:270:55: note: in definition of macro '____define_initcall'
     270 |                 __attribute__((__section__(__sec))) = fn;
         |                                                       ^~
   include/linux/init.h:280:9: note: in expansion of macro '__unique_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:282:35: note: in expansion of macro '___define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:289:41: note: in expansion of macro '__define_initcall'
     289 | #define early_initcall(fn)              __define_initcall(fn, early)
         |                                         ^~~~~~~~~~~~~~~~~
   kernel/irq_work.c:335:1: note: in expansion of macro 'early_initcall'
     335 | early_initcall(irq_work_init_threads);
         | ^~~~~~~~~~~~~~
>> kernel/irq_work.c:335:1: error: expected declaration or statement at end of input


vim +/run_irq_workd +311 kernel/irq_work.c

b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  310  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @311  static void run_irq_workd(unsigned int cpu)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  312  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  313  	irq_work_run_list(this_cpu_ptr(&lazy_list));
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  314  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  315  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @316  static void irq_workd_setup(unsigned int cpu)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  317  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  318  	sched_set_fifo_low(current);
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  319  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  320  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  321  static struct smp_hotplug_thread irqwork_threads = {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  322  	.store                  = &irq_workd,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @323  	.setup			= irq_workd_setup,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  324  	.thread_should_run      = irq_workd_should_run,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  325  	.thread_fn              = run_irq_workd,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  326  	.thread_comm            = "irq_work/%u",
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  327  };
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  328  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @329  static __init int irq_work_init_threads(void)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  330  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  331  	if (IS_ENABLED(CONFIG_PREEMPT_RT))
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  332  		BUG_ON(smpboot_register_percpu_thread(&irqwork_threads));
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  333  	return 0;
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  334  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @335  early_initcall(irq_work_init_threads);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
  2024-09-18 15:23 [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched() Steven Davis
  2024-09-19 13:54 ` Thomas Gleixner
  2024-09-21 14:42 ` kernel test robot
@ 2024-09-21 15:13 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-09-21 15:13 UTC (permalink / raw)
  To: Steven Davis, akpm; +Cc: llvm, oe-kbuild-all, linux-kernel, Steven Davis

Hi Steven,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v6.11 next-20240920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Steven-Davis/irq_work-Improve-CPU-Responsiveness-in-irq_work_sync-with-cond_resched/20240918-232606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/SJ2P223MB10263844181902531B671FB6F7622%40SJ2P223MB1026.NAMP223.PROD.OUTLOOK.COM
patch subject: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched()
config: um-allnoconfig (https://download.01.org/0day-ci/archive/20240921/202409212247.nX8LW3Px-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240921/202409212247.nX8LW3Px-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409212247.nX8LW3Px-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/irq_work.c:14:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from kernel/irq_work.c:14:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from kernel/irq_work.c:14:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     693 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     701 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     709 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     718 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     727 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     736 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> kernel/irq_work.c:312:1: error: function definition is not allowed here
     312 | {
         | ^
   kernel/irq_work.c:317:1: error: function definition is not allowed here
     317 | {
         | ^
>> kernel/irq_work.c:323:13: error: use of undeclared identifier 'irq_workd_setup'
     323 |         .setup                  = irq_workd_setup,
         |                                   ^
>> kernel/irq_work.c:325:28: error: use of undeclared identifier 'run_irq_workd'
     325 |         .thread_fn              = run_irq_workd,
         |                                   ^
   kernel/irq_work.c:330:1: error: function definition is not allowed here
     330 | {
         | ^
>> kernel/irq_work.c:335:16: error: use of undeclared identifier 'irq_work_init_threads'; did you mean 'irqwork_threads'?
     335 | early_initcall(irq_work_init_threads);
         |                ^~~~~~~~~~~~~~~~~~~~~
         |                irqwork_threads
   include/linux/init.h:289:47: note: expanded from macro 'early_initcall'
     289 | #define early_initcall(fn)              __define_initcall(fn, early)
         |                                                           ^
   include/linux/init.h:282:54: note: expanded from macro '__define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                                      ^
   include/linux/init.h:280:20: note: expanded from macro '___define_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |                           ^
   include/linux/init.h:274:22: note: expanded from macro '__unique_initcall'
     274 |         ____define_initcall(fn,                                 \
         |                             ^
   include/linux/init.h:270:41: note: expanded from macro '____define_initcall'
     270 |                 __attribute__((__section__(__sec))) = fn;
         |                                                       ^
   kernel/irq_work.c:321:34: note: 'irqwork_threads' declared here
     321 | static struct smp_hotplug_thread irqwork_threads = {
         |                                  ^
>> kernel/irq_work.c:335:1: error: initializing 'initcall_t' (aka 'int (*)(void)') with an expression of incompatible type 'struct smp_hotplug_thread'
     335 | early_initcall(irq_work_init_threads);
         | ^              ~~~~~~~~~~~~~~~~~~~~~
   include/linux/init.h:289:29: note: expanded from macro 'early_initcall'
     289 | #define early_initcall(fn)              __define_initcall(fn, early)
         |                                         ^                 ~~
   include/linux/init.h:282:35: note: expanded from macro '__define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^                  ~~
   include/linux/init.h:280:2: note: expanded from macro '___define_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^                 ~~
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:69:1: note: expanded from here
      69 | __initcall__kmod_irq_work__193_335_irq_work_init_threadsearly
         | ^
   include/linux/init.h:269:20: note: expanded from macro '____define_initcall'
     269 |         static initcall_t __name __used                         \
         |                           ^
     270 |                 __attribute__((__section__(__sec))) = fn;
         |                                                       ~~
>> kernel/irq_work.c:335:39: error: expected '}'
     335 | early_initcall(irq_work_init_threads);
         |                                       ^
   kernel/irq_work.c:287:1: note: to match this '{'
     287 | {
         | ^
   12 warnings and 8 errors generated.


vim +312 kernel/irq_work.c

b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  310  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  311  static void run_irq_workd(unsigned int cpu)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @312  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  313  	irq_work_run_list(this_cpu_ptr(&lazy_list));
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  314  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  315  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  316  static void irq_workd_setup(unsigned int cpu)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  317  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  318  	sched_set_fifo_low(current);
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  319  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  320  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @321  static struct smp_hotplug_thread irqwork_threads = {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  322  	.store                  = &irq_workd,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @323  	.setup			= irq_workd_setup,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  324  	.thread_should_run      = irq_workd_should_run,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @325  	.thread_fn              = run_irq_workd,
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  326  	.thread_comm            = "irq_work/%u",
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  327  };
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  328  
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  329  static __init int irq_work_init_threads(void)
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  330  {
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  331  	if (IS_ENABLED(CONFIG_PREEMPT_RT))
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  332  		BUG_ON(smpboot_register_percpu_thread(&irqwork_threads));
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  333  	return 0;
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07  334  }
b4c6f86ec2f648 Sebastian Andrzej Siewior 2021-10-07 @335  early_initcall(irq_work_init_threads);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-09-21 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18 15:23 [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync with cond_resched() Steven Davis
2024-09-19 13:54 ` Thomas Gleixner
2024-09-19 15:25   ` Steven Davis
2024-09-21 14:42 ` kernel test robot
2024-09-21 15:13 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox