All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kthread: export park/unpark facility
@ 2015-07-09  0:40 Jean Tourrilhes
  2015-07-09  3:23 ` Peter Hurley
  2015-07-09  8:05 ` Thomas Gleixner
  0 siblings, 2 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2015-07-09  0:40 UTC (permalink / raw)
  To: Thomas Gleixner, Rusty Russell; +Cc: linux-kernel

	Hi,

	The kthread park/unpark facility is not used in the kernel, so
one would assume that it's made for kernel modules. This patch should
definitely help most modules.
	Patch untested, at your own risks...
	Regards,

	Jean

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>

diff -u -p linux-3.18.17/kernel/kthread.j2.c linux-3.18.17/kernel/kthread.c
--- linux-3.18.17/kernel/kthread.j2.c	2015-07-08 17:01:39.010554169 -0700
+++ linux-3.18.17/kernel/kthread.c	2015-07-08 17:09:13.016096189 -0700
@@ -97,6 +97,7 @@ bool kthread_should_park(void)
 {
 	return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);
 }
+EXPORT_SYMBOL(kthread_should_park);
 
 /**
  * kthread_freezable_should_stop - should this freezable kthread return now?
@@ -171,6 +172,7 @@ void kthread_parkme(void)
 {
 	__kthread_parkme(to_kthread(current));
 }
+EXPORT_SYMBOL(kthread_parkme);
 
 static int kthread(void *_create)
 {
@@ -411,6 +413,7 @@ void kthread_unpark(struct task_struct *
 	if (kthread)
 		__kthread_unpark(k, kthread);
 }
+EXPORT_SYMBOL(kthread_unpark);
 
 /**
  * kthread_park - park a thread created by kthread_create().
@@ -441,6 +444,7 @@ int kthread_park(struct task_struct *k)
 	}
 	return ret;
 }
+EXPORT_SYMBOL(kthread_park);
 
 /**
  * kthread_stop - stop a thread created by kthread_create().

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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09  0:40 [PATCH] kthread: export park/unpark facility Jean Tourrilhes
@ 2015-07-09  3:23 ` Peter Hurley
  2015-07-09 16:08   ` Jean Tourrilhes
  2015-07-09  8:05 ` Thomas Gleixner
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Hurley @ 2015-07-09  3:23 UTC (permalink / raw)
  To: jt; +Cc: Thomas Gleixner, Rusty Russell, linux-kernel

On 07/08/2015 08:40 PM, Jean Tourrilhes wrote:
> 	Hi,
> 
> 	The kthread park/unpark facility is not used in the kernel

kernel/smpboot.c ?


> , so one would assume that it's made for kernel modules. This patch should
> definitely help most modules.
> 	Patch untested, at your own risks...
> 	Regards,
> 
> 	Jean
> 
> Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
> 
> diff -u -p linux-3.18.17/kernel/kthread.j2.c linux-3.18.17/kernel/kthread.c
> --- linux-3.18.17/kernel/kthread.j2.c	2015-07-08 17:01:39.010554169 -0700
> +++ linux-3.18.17/kernel/kthread.c	2015-07-08 17:09:13.016096189 -0700
> @@ -97,6 +97,7 @@ bool kthread_should_park(void)
>  {
>  	return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);
>  }
> +EXPORT_SYMBOL(kthread_should_park);
>  
>  /**
>   * kthread_freezable_should_stop - should this freezable kthread return now?
> @@ -171,6 +172,7 @@ void kthread_parkme(void)
>  {
>  	__kthread_parkme(to_kthread(current));
>  }
> +EXPORT_SYMBOL(kthread_parkme);
>  
>  static int kthread(void *_create)
>  {
> @@ -411,6 +413,7 @@ void kthread_unpark(struct task_struct *
>  	if (kthread)
>  		__kthread_unpark(k, kthread);
>  }
> +EXPORT_SYMBOL(kthread_unpark);
>  
>  /**
>   * kthread_park - park a thread created by kthread_create().
> @@ -441,6 +444,7 @@ int kthread_park(struct task_struct *k)
>  	}
>  	return ret;
>  }
> +EXPORT_SYMBOL(kthread_park);
>  
>  /**
>   * kthread_stop - stop a thread created by kthread_create().


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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09  0:40 [PATCH] kthread: export park/unpark facility Jean Tourrilhes
  2015-07-09  3:23 ` Peter Hurley
@ 2015-07-09  8:05 ` Thomas Gleixner
  2015-07-09 16:20   ` Jean Tourrilhes
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2015-07-09  8:05 UTC (permalink / raw)
  To: Jean Tourrilhes; +Cc: Rusty Russell, linux-kernel

On Wed, 8 Jul 2015, Jean Tourrilhes wrote:

> The kthread park/unpark facility is not used in the kernel, so

git grep kthread.*park tells a different story

> one would assume that it's made for kernel modules.

Certainly not.

>  This patch should definitely help most modules.

And how exactly would this help modules?

Thanks,

	tglx

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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09  3:23 ` Peter Hurley
@ 2015-07-09 16:08   ` Jean Tourrilhes
  0 siblings, 0 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2015-07-09 16:08 UTC (permalink / raw)
  To: Peter Hurley; +Cc: Thomas Gleixner, Rusty Russell, linux-kernel

On Wed, Jul 08, 2015 at 11:23:41PM -0400, Peter Hurley wrote:
> On 07/08/2015 08:40 PM, Jean Tourrilhes wrote:
> > 	Hi,
> > 
> > 	The kthread park/unpark facility is not used in the kernel
> 
> kernel/smpboot.c ?

	Got me, I should have said hardly used.
	Sorry for the gross exageration ;-)

	Jean

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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09  8:05 ` Thomas Gleixner
@ 2015-07-09 16:20   ` Jean Tourrilhes
  2015-07-09 16:49     ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Tourrilhes @ 2015-07-09 16:20 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Rusty Russell, linux-kernel

On Thu, Jul 09, 2015 at 10:05:02AM +0200, Thomas Gleixner wrote:
> 
> >  This patch should definitely help most modules.
> 
> And how exactly would this help modules?

	Putting kthread to sleep and waking them up later is slightly
tricky :
		http://www.linuxjournal.com/article/8144

	The park and unpark API encapsulate this functionality in
a pretty nice and clean API, and avoid duplicating this code in
various modules. I'm all for sharing the joy ;-)

> Thanks,
> 
> 	tglx

	Regards,

	Jean

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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09 16:20   ` Jean Tourrilhes
@ 2015-07-09 16:49     ` Thomas Gleixner
  2015-07-09 16:53       ` Jean Tourrilhes
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2015-07-09 16:49 UTC (permalink / raw)
  To: Jean Tourrilhes; +Cc: Rusty Russell, linux-kernel

On Thu, 9 Jul 2015, Jean Tourrilhes wrote:
> On Thu, Jul 09, 2015 at 10:05:02AM +0200, Thomas Gleixner wrote:
> > 
> > >  This patch should definitely help most modules.
> > 
> > And how exactly would this help modules?
> 
> 	Putting kthread to sleep and waking them up later is slightly
> tricky :
> 		http://www.linuxjournal.com/article/8144
> 
> 	The park and unpark API encapsulate this functionality in
> a pretty nice and clean API, and avoid duplicating this code in
> various modules. I'm all for sharing the joy ;-)

If you can come up with a proper use case, i.e. patch for a module,
then we can certainly talk about the exports. But without a user it
does not make any sense.

Thanks,

	tglx

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

* Re: [PATCH] kthread: export park/unpark facility
  2015-07-09 16:49     ` Thomas Gleixner
@ 2015-07-09 16:53       ` Jean Tourrilhes
  0 siblings, 0 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2015-07-09 16:53 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Rusty Russell, linux-kernel

On Thu, Jul 09, 2015 at 06:49:21PM +0200, Thomas Gleixner wrote:
> 
> If you can come up with a proper use case, i.e. patch for a module,
> then we can certainly talk about the exports. But without a user it
> does not make any sense.

	My module is currently out of the tree, so obviously it does
not count.
	Regards,

	Jean

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09  0:40 [PATCH] kthread: export park/unpark facility Jean Tourrilhes
2015-07-09  3:23 ` Peter Hurley
2015-07-09 16:08   ` Jean Tourrilhes
2015-07-09  8:05 ` Thomas Gleixner
2015-07-09 16:20   ` Jean Tourrilhes
2015-07-09 16:49     ` Thomas Gleixner
2015-07-09 16:53       ` Jean Tourrilhes

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.