Skip to contentSkip to conversation

kthread: Export kthread_data()

PATCH In review Waiman Long 3 participants 5 messages Feb 9, 2018 – Feb 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kthread: Export kthread_data()

When multiple kernel threads are created to cooperatively work on a common task, we may need a convenient way to access data that are specific to each kthread.

The kthread_data() function fits this need. However, it was not visible to kthreads started in a kernel module. To solve this problem, the kthread_data() function is now exported allowing kthreads from kernel modules to use it.

---
 kernel/kthread.c | 1 +
 1 file changed, 1 insertion(+)
kernel/kthread.c +1 -0
index cd50e99..a71d461 100644
@@ -156,6 +156,7 @@ void *kthread_data(struct task_struct *task)
 {
 	return to_kthread(task)->data;
 }
+EXPORT_SYMBOL(kthread_data);
 
 /**
  * kthread_probe_data - speculative version of kthread_data()
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Waiman Long

When multiple kernel threads are created to cooperatively work on a common task, we may need a convenient way to access data that are specific to each kthread.

The kthread_data() function fits this need. However, it was not visible to kthreads started in a kernel module. To solve this problem, the kthread_data() function is now exported allowing kthreads from kernel modules to use it.

No. Without an in-tree user, no export.

#2 lore raw
In reply to Waiman Long
Quoted 8 lines · Waiman Long

When multiple kernel threads are created to cooperatively work on a common task, we may need a convenient way to access data that are specific to each kthread.

The kthread_data() function fits this need. However, it was not visible to kthreads started in a kernel module. To solve this problem, the kthread_data() function is now exported allowing kthreads from kernel modules to use it.

Please send this along wit hthe actual user of it.

#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Waiman Long

When multiple kernel threads are created to cooperatively work on a common task, we may need a convenient way to access data that are specific to each kthread.

The kthread_data() function fits this need. However, it was not visible to kthreads started in a kernel module. To solve this problem, the kthread_data() function is now exported allowing kthreads from kernel modules to use it.

Please send this along wit hthe actual user of it.

It is the developers of the dm-vdo/kvdo modules that would like to use the kthread_data() function. See

https://github.com/dm-vdo/kvdo

Those modules have a bunch of kernel threads working on block storage deduplication/compression.

-Longman

#4 lore raw
Quoted 14 lines · Waiman Long
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Waiman Long

When multiple kernel threads are created to cooperatively work on a common task, we may need a convenient way to access data that are specific to each kthread.

The kthread_data() function fits this need. However, it was not visible to kthreads started in a kernel module. To solve this problem, the kthread_data() function is now exported allowing kthreads from kernel modules to use it.

Please send this along wit hthe actual user of it.

It is the developers of the dm-vdo/kvdo modules that would like to use the kthread_data() function. See

Quoted 7 lines

https://github.com/dm-vdo/kvdo

Those modules have a bunch of kernel threads working on block storage deduplication/compression.

-Longman

BTW, I am fine with not exporting the function. They just have to find an alternative way of doing it.

-Longman