2#ifndef _LINUX_KTHREAD_H
3#define _LINUX_KTHREAD_H
21static inline struct kthread *tsk_is_kthread(
struct task_struct *p)
45#define kthread_create(threadfn, data, namefmt, arg...) \
46 kthread_create_on_node(threadfn, data, NUMA_NO_NODE, namefmt, ##arg)
69#define kthread_run(threadfn, data, namefmt, ...) \
71 struct task_struct *__k \
72 = kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \
74 wake_up_process(__k); \
91kthread_run_on_cpu(
int (*threadfn)(
void *
data),
void *
data,
92 unsigned int cpu,
const char *
namefmt)
119#define kthread_exit(result) do_exit(result)
166#define KTHREAD_WORK_INIT(work, fn) { \
167 .node = LIST_HEAD_INIT((work).node), \
171#define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \
172 .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \
173 .timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn,\
177#define DEFINE_KTHREAD_WORK(work, fn) \
178 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
180#define DEFINE_KTHREAD_DELAYED_WORK(dwork, fn) \
181 struct kthread_delayed_work dwork = \
182 KTHREAD_DELAYED_WORK_INIT(dwork, fn)
187#define kthread_init_worker(worker) \
189 static struct lock_class_key __key; \
190 __kthread_init_worker((worker), "("#worker")->lock", &__key); \
193#define kthread_init_work(work, fn) \
195 memset((work), 0, sizeof(struct kthread_work)); \
196 INIT_LIST_HEAD(&(work)->node); \
197 (work)->func = (fn); \
200#define kthread_init_delayed_work(dwork, fn) \
202 kthread_init_work(&(dwork)->work, (fn)); \
203 timer_setup(&(dwork)->timer, \
204 kthread_delayed_work_timer_fn, \
215#define kthread_create_worker(flags, namefmt, ...) \
216 kthread_create_worker_on_node(flags, NUMA_NO_NODE, namefmt, ## __VA_ARGS__);
226#define kthread_run_worker(flags, namefmt, ...) \
228 struct kthread_worker *__kw \
229 = kthread_create_worker(flags, namefmt, ## __VA_ARGS__); \
231 wake_up_process(__kw->task); \
251kthread_run_worker_on_cpu(
int cpu,
unsigned int flags,
258 wake_up_process(kw->
task);
268 unsigned long delay);
272 unsigned long delay);
285struct cgroup_subsys_state;
287#ifdef CONFIG_BLK_CGROUP
288void kthread_associate_blkcg(
struct cgroup_subsys_state *css);
289struct cgroup_subsys_state *kthread_blkcg(
void);
291static inline void kthread_associate_blkcg(
struct cgroup_subsys_state *css) { }
uint8_t flags
Definition virtio.h:0
XETime t
Definition main.cpp:53
#define NULL
Definition actypes.h:561
#define __printf(fmt_idx, arg_idx)
Definition compiler.h:144
#define __noreturn
Definition compiler_attributes.h:271
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
#define IS_ERR(ptr)
Definition err.h:59
bool kthread_freezable_should_stop(bool *was_frozen)
void kthread_bind(struct task_struct *k, unsigned int cpu)
void * kthread_probe_data(struct task_struct *k)
bool kthread_is_per_cpu(struct task_struct *k)
int kthreadd(void *unused)
void free_kthread_struct(struct task_struct *k)
struct task_struct * kthreadd_task
bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work)
void kthread_do_exit(struct kthread *, long)
@ KTW_FREEZABLE
Definition kthread.h:141
void kthread_set_per_cpu(struct task_struct *k, int cpu)
bool kthread_cancel_work_sync(struct kthread_work *work)
int kthread_park(struct task_struct *k)
void kthread_flush_worker(struct kthread_worker *worker)
bool kthread_should_park(void)
void int const char namefmt[]
Definition kthread.h:32
void(* kthread_work_func_t)(struct kthread_work *work)
Definition kthread.h:137
int kthreads_update_housekeeping(void)
void * data
Definition kthread.h:30
void kthread_parkme(void)
bool kthread_queue_work(struct kthread_worker *worker, struct kthread_work *work)
bool kthread_should_stop_or_park(void)
void kthread_destroy_worker(struct kthread_worker *worker)
void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask)
bool set_kthread_struct(struct task_struct *p)
int kthread_stop_put(struct task_struct *k)
void kthread_flush_work(struct kthread_work *work)
void * kthread_data(struct task_struct *k)
void * kthread_func(struct task_struct *k)
void kthread_unpark(struct task_struct *k)
int kthread_stop(struct task_struct *k)
bool kthread_queue_delayed_work(struct kthread_worker *worker, struct kthread_delayed_work *dwork, unsigned long delay)
void __kthread_init_worker(struct kthread_worker *worker, const char *name, struct lock_class_key *key)
int tsk_fork_get_node(struct task_struct *tsk)
struct task_struct * kthread_create_on_cpu(int(*threadfn)(void *data), void *data, unsigned int cpu, const char *namefmt)
void kthread_use_mm(struct mm_struct *mm)
int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
void get_kthread_comm(char *buf, size_t buf_size, struct task_struct *tsk)
bool kthread_mod_delayed_work(struct kthread_worker *worker, struct kthread_delayed_work *dwork, unsigned long delay)
int kthread_worker_fn(void *worker_ptr)
void kthread_delayed_work_timer_fn(struct timer_list *t)
bool kthread_should_stop(void)
struct kthread_worker * kthread_create_worker_on_cpu(int cpu, unsigned int flags, const char namefmt[])
void int node
Definition kthread.h:31
void kthread_unuse_mm(struct mm_struct *mm)
void kthread_complete_and_exit(struct completion *, long) __noreturn
#define PF_KTHREAD
Definition sched.h:102
Definition completion.h:55
struct kthread_work work
Definition kthread.h:162
struct timer_list timer
Definition kthread.h:163
kthread_work_func_t func
Definition kthread.h:155
int canceling
Definition kthread.h:158
struct kthread_worker * worker
Definition kthread.h:156
struct list_head node
Definition kthread.h:154
unsigned int flags
Definition kthread.h:145
raw_spinlock_t lock
Definition kthread.h:146
struct task_struct * task
Definition kthread.h:149
struct list_head work_list
Definition kthread.h:147
struct list_head delayed_work_list
Definition kthread.h:148
struct kthread_work * current_work
Definition kthread.h:150
unsigned int flags
Definition sched.h:125
void * worker_private
Definition sched.h:126