/** * kthread_create - create a kthread on the current node * @threadfn: the function to run in the thread * @data: data pointer for @threadfn() * @namefmt: printf-style format string for the thread name * @arg: arguments for @namefmt. * * This macro will create a kthread on the current node, leaving it in * the stopped state. This is just a helper for kthread_create_on_node(); * see the documentation there for more details.
*/ #define kthread_create(threadfn, data, namefmt, arg...) \
kthread_create_on_node(threadfn, data, NUMA_NO_NODE, namefmt, ##arg)
void kthread_set_per_cpu(struct task_struct *k, int cpu); bool kthread_is_per_cpu(struct task_struct *k);
/** * kthread_run - create and wake a thread. * @threadfn: the function to run until signal_pending(current). * @data: data ptr for @threadfn. * @namefmt: printf-style name for the thread. * * Description: Convenient wrapper for kthread_create() followed by * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
*/ #define kthread_run(threadfn, data, namefmt, ...) \
({ \ struct task_struct *__k \
= kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \ if (!IS_ERR(__k)) \
wake_up_process(__k); \
__k; \
})
/** * kthread_run_on_cpu - create and wake a cpu bound thread. * @threadfn: the function to run until signal_pending(current). * @data: data ptr for @threadfn. * @cpu: The cpu on which the thread should be bound, * @namefmt: printf-style name for the thread. Format is restricted * to "name.*%u". Code fills in cpu number. * * Description: Convenient wrapper for kthread_create_on_cpu() * followed by wake_up_process(). Returns the kthread or * ERR_PTR(-ENOMEM).
*/ staticinlinestruct task_struct *
kthread_run_on_cpu(int (*threadfn)(void *data), void *data, unsignedint cpu, constchar *namefmt)
{ struct task_struct *p;
p = kthread_create_on_cpu(threadfn, data, cpu, namefmt); if (!IS_ERR(p))
wake_up_process(p);
int kthreadd(void *unused); externstruct task_struct *kthreadd_task; externint tsk_fork_get_node(struct task_struct *tsk);
/* * Simple work processor based on kthread. * * This provides easier way to make use of kthreads. A kthread_work * can be queued and flushed using queue/kthread_flush_work() * respectively. Queued kthread_works are processed by a kthread * running kthread_worker_fn().
*/ struct kthread_work; typedefvoid (*kthread_work_func_t)(struct kthread_work *work); void kthread_delayed_work_timer_fn(struct timer_list *t);
struct kthread_work { struct list_head node;
kthread_work_func_t func; struct kthread_worker *worker; /* Number of canceling calls that are running at the moment. */ int canceling;
};
/** * kthread_run_worker - create and wake a kthread worker. * @flags: flags modifying the default behavior of the worker * @namefmt: printf-style name for the thread. * * Description: Convenient wrapper for kthread_create_worker() followed by * wake_up_process(). Returns the kthread_worker or ERR_PTR(-ENOMEM).
*/ #define kthread_run_worker(flags, namefmt, ...) \
({ \ struct kthread_worker *__kw \
= kthread_create_worker(flags, namefmt, ## __VA_ARGS__); \ if (!IS_ERR(__kw)) \
wake_up_process(__kw->task); \
__kw; \
})
/** * kthread_run_worker_on_cpu - create and wake a cpu bound kthread worker. * @cpu: CPU number * @flags: flags modifying the default behavior of the worker * @namefmt: printf-style name for the thread. Format is restricted * to "name.*%u". Code fills in cpu number. * * Description: Convenient wrapper for kthread_create_worker_on_cpu() * followed by wake_up_process(). Returns the kthread_worker or * ERR_PTR(-ENOMEM).
*/ staticinlinestruct kthread_worker *
kthread_run_worker_on_cpu(int cpu, unsignedint flags, constchar namefmt[])
{ struct kthread_worker *kw;
kw = kthread_create_worker_on_cpu(cpu, flags, namefmt); if (!IS_ERR(kw))
wake_up_process(kw->task);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.