From: Randy Dunlap on
On Sat, 19 Jun 2010 17:53:55 +0200 Tejun Heo wrote:

> include/linux/kthread.h | 63 +++++++++++++++++++++++++
> kernel/kthread.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 181 insertions(+)
>
> Index: work/kernel/kthread.c
> ===================================================================
> --- work.orig/kernel/kthread.c
> +++ work/kernel/kthread.c

> @@ -247,3 +249,119 @@ int kthreadd(void *unused)
>
> return 0;
> }
> +
> +/**
> + * kthread_worker_fn - kthread function to process kthread_worker
> + * @data: pointer to initialized kthread_worker

s/data/worker_ptr/

> + *
> + * This function can be used as @threadfn to kthread_create() or
> + * kthread_run() with @data argument pointing to an initialized

ditto.

> + * kthread_worker. The started kthread will process work_list until
> + * the it is stopped with kthread_stop(). A kthread can also call
> + * this function directly after extra initialization.
> + *
> + * Different kthreads can be used for the same kthread_worker as long
> + * as there's only one kthread attached to it at any given time. A
> + * kthread_worker without an attached kthread simply collects queued
> + * kthread_works.
> + */
> +int kthread_worker_fn(void *worker_ptr)
> +{
> + struct kthread_worker *worker = worker_ptr;
> + struct kthread_work *work;
> +
> + WARN_ON(worker->task);
> + worker->task = current;
> +repeat:


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
Hello,

On 06/21/2010 10:33 PM, Randy Dunlap wrote:
> On Sat, 19 Jun 2010 17:53:55 +0200 Tejun Heo wrote:
>
>> include/linux/kthread.h | 63 +++++++++++++++++++++++++
>> kernel/kthread.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 181 insertions(+)
>>
>> Index: work/kernel/kthread.c
>> ===================================================================
>> --- work.orig/kernel/kthread.c
>> +++ work/kernel/kthread.c
>
>> @@ -247,3 +249,119 @@ int kthreadd(void *unused)
>>
>> return 0;
>> }
>> +
>> +/**
>> + * kthread_worker_fn - kthread function to process kthread_worker
>> + * @data: pointer to initialized kthread_worker
>
> s/data/worker_ptr/
>
>> + *
>> + * This function can be used as @threadfn to kthread_create() or
>> + * kthread_run() with @data argument pointing to an initialized
>
> ditto.

Yeah, that would be a much better idea. Updated.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/