kthread: export park/unpark facility
PATCH 1/1 kthread: export park/unpark facility
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
kernel/kthread.c renamed from kernel/kthread.j2.c +4 -0
@@ -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().
Quoted 3 lines · Jean Tourrilhes
Hi, The kthread park/unpark facility is not used in the kernel
kernel/smpboot.c ?
Quoted 44 lines
, 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 <[email protected]>diff -u -p
linux-3.18.17/kernel/kthread.j2.clinux-3.18.17/kernel/kthread.ckernel/kthread.c renamed from kernel/kthread.j2.c +4
-0@@ -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().
Quoted 6 lines · Peter Hurley
Quoted 3 lines · Jean Tourrilhes
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
Quoted 1 line · Jean Tourrilhes
The kthread park/unpark facility is not used in the kernel, so
git grep kthread.*park tells a different story
Quoted 1 line
one would assume that it's made for kernel modules.
Certainly not.
Quoted 1 line
This patch should definitely help most modules.
And how exactly would this help modules?
Thanks,
tglx
Quoted 4 lines · Thomas Gleixner
Quoted 2 lines
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 ;-)
Quoted 3 lines
Thanks,
tglx
Regards,
Jean
Quoted 6 lines · Jean Tourrilhes
Quoted 4 lines · Thomas Gleixner
Quoted 2 lines
This patch should definitely help most modules.
And how exactly would this help modules?
Quoted 7 lines
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 ina 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
Quoted 4 lines · Thomas Gleixner
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