XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
kthread.h File Reference
#include <linux/err.h>
#include <linux/sched.h>
Include dependency graph for kthread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kthread_worker
 
struct  kthread_work
 
struct  kthread_delayed_work
 

Macros

#define kthread_create(threadfn, data, namefmt, arg...)    kthread_create_on_node(threadfn, data, NUMA_NO_NODE, namefmt, ##arg)
 
#define kthread_run(threadfn, data, namefmt, ...)
 
#define kthread_exit(result)   do_exit(result)
 
#define KTHREAD_WORK_INIT(work, fn)
 
#define KTHREAD_DELAYED_WORK_INIT(dwork, fn)
 
#define DEFINE_KTHREAD_WORK(work, fn)    struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
 
#define DEFINE_KTHREAD_DELAYED_WORK(dwork, fn)
 
#define kthread_init_worker(worker)
 
#define kthread_init_work(work, fn)
 
#define kthread_init_delayed_work(dwork, fn)
 
#define kthread_create_worker(flags, namefmt, ...)    kthread_create_worker_on_node(flags, NUMA_NO_NODE, namefmt, ## __VA_ARGS__);
 
#define kthread_run_worker(flags, namefmt, ...)
 

Typedefs

typedef void(* kthread_work_func_t) (struct kthread_work *work)
 

Enumerations

enum  { KTW_FREEZABLE = 1 << 0 }
 

Functions

 __printf (4, 5) struct task_struct *kthread_create_on_node(int(*threadfn)(void *data)
 
struct task_struct * kthread_create_on_cpu (int(*threadfn)(void *data), void *data, unsigned int cpu, const char *namefmt)
 
void get_kthread_comm (char *buf, size_t buf_size, struct task_struct *tsk)
 
bool set_kthread_struct (struct task_struct *p)
 
void kthread_set_per_cpu (struct task_struct *k, int cpu)
 
bool kthread_is_per_cpu (struct task_struct *k)
 
void free_kthread_struct (struct task_struct *k)
 
void kthread_bind (struct task_struct *k, unsigned int cpu)
 
void kthread_bind_mask (struct task_struct *k, const struct cpumask *mask)
 
int kthread_affine_preferred (struct task_struct *p, const struct cpumask *mask)
 
int kthread_stop (struct task_struct *k)
 
int kthread_stop_put (struct task_struct *k)
 
bool kthread_should_stop (void)
 
bool kthread_should_park (void)
 
bool kthread_should_stop_or_park (void)
 
bool kthread_freezable_should_stop (bool *was_frozen)
 
void * kthread_func (struct task_struct *k)
 
void * kthread_data (struct task_struct *k)
 
void * kthread_probe_data (struct task_struct *k)
 
int kthread_park (struct task_struct *k)
 
void kthread_unpark (struct task_struct *k)
 
void kthread_parkme (void)
 
void kthread_complete_and_exit (struct completion *, long) __noreturn
 
int kthreads_update_housekeeping (void)
 
void kthread_do_exit (struct kthread *, long)
 
int kthreadd (void *unused)
 
int tsk_fork_get_node (struct task_struct *tsk)
 
void kthread_delayed_work_timer_fn (struct timer_list *t)
 
void __kthread_init_worker (struct kthread_worker *worker, const char *name, struct lock_class_key *key)
 
int kthread_worker_fn (void *worker_ptr)
 
 __printf (3, 4) struct kthread_worker *kthread_create_worker_on_node(unsigned int flags
 
struct kthread_worker * kthread_create_worker_on_cpu (int cpu, unsigned int flags, const char namefmt[])
 
bool kthread_queue_work (struct kthread_worker *worker, struct kthread_work *work)
 
bool kthread_queue_delayed_work (struct kthread_worker *worker, struct kthread_delayed_work *dwork, unsigned long delay)
 
bool kthread_mod_delayed_work (struct kthread_worker *worker, struct kthread_delayed_work *dwork, unsigned long delay)
 
void kthread_flush_work (struct kthread_work *work)
 
void kthread_flush_worker (struct kthread_worker *worker)
 
bool kthread_cancel_work_sync (struct kthread_work *work)
 
bool kthread_cancel_delayed_work_sync (struct kthread_delayed_work *work)
 
void kthread_destroy_worker (struct kthread_worker *worker)
 
void kthread_use_mm (struct mm_struct *mm)
 
void kthread_unuse_mm (struct mm_struct *mm)
 

Variables

void * data
 
void int node
 
void int const char namefmt []
 
struct task_struct * kthreadd_task
 

Macro Definition Documentation

◆ DEFINE_KTHREAD_DELAYED_WORK

#define DEFINE_KTHREAD_DELAYED_WORK (   dwork,
  fn 
)
Value:
struct kthread_delayed_work dwork = \
KTHREAD_DELAYED_WORK_INIT(dwork, fn)
void * fn
Definition audrv.c:980
Definition kthread.h:161

◆ DEFINE_KTHREAD_WORK

#define DEFINE_KTHREAD_WORK (   work,
  fn 
)     struct kthread_work work = KTHREAD_WORK_INIT(work, fn)

◆ kthread_create

#define kthread_create (   threadfn,
  data,
  namefmt,
  arg... 
)     kthread_create_on_node(threadfn, data, NUMA_NO_NODE, namefmt, ##arg)

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

  • : 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.

◆ kthread_create_worker

#define kthread_create_worker (   flags,
  namefmt,
  ... 
)     kthread_create_worker_on_node(flags, NUMA_NO_NODE, namefmt, ## __VA_ARGS__);

◆ KTHREAD_DELAYED_WORK_INIT

#define KTHREAD_DELAYED_WORK_INIT (   dwork,
  fn 
)
Value:
{ \
.work = KTHREAD_WORK_INIT((dwork).work, (fn)), \
.timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn,\
TIMER_IRQSAFE), \
}
#define KTHREAD_WORK_INIT(work, fn)
Definition kthread.h:166
void kthread_delayed_work_timer_fn(struct timer_list *t)

◆ kthread_exit

#define kthread_exit (   result)    do_exit(result)

◆ kthread_init_delayed_work

#define kthread_init_delayed_work (   dwork,
  fn 
)
Value:
do { \
kthread_init_work(&(dwork)->work, (fn)); \
timer_setup(&(dwork)->timer, \
TIMER_IRQSAFE); \
} while (0)

◆ kthread_init_work

#define kthread_init_work (   work,
  fn 
)
Value:
do { \
memset((work), 0, sizeof(struct kthread_work)); \
INIT_LIST_HEAD(&(work)->node); \
(work)->func = (fn); \
} while (0)
void int node
Definition kthread.h:31
Definition kthread.h:153

◆ kthread_init_worker

#define kthread_init_worker (   worker)
Value:
do { \
static struct lock_class_key __key; \
__kthread_init_worker((worker), "("#worker")->lock", &__key); \
} while (0)
Definition lockdep.h:160

◆ kthread_run

#define kthread_run (   threadfn,
  data,
  namefmt,
  ... 
)
Value:
({ \
struct task_struct *__k \
= kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \
if (!IS_ERR(__k)) \
wake_up_process(__k); \
__k; \
})
#define IS_ERR(ptr)
Definition err.h:59
void int const char namefmt[]
Definition kthread.h:32
void * data
Definition kthread.h:30
#define kthread_create(threadfn, data, namefmt, arg...)
Definition kthread.h:45
Definition sched.h:121

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).

◆ kthread_run_worker

#define kthread_run_worker (   flags,
  namefmt,
  ... 
)
Value:
({ \
struct kthread_worker *__kw \
= kthread_create_worker(flags, namefmt, ## __VA_ARGS__); \
if (!IS_ERR(__kw)) \
wake_up_process(__kw->task); \
__kw; \
})
uint8_t flags
Definition virtio.h:0
#define kthread_create_worker(flags, namefmt,...)
Definition kthread.h:215
Definition kthread.h:144

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).

◆ KTHREAD_WORK_INIT

#define KTHREAD_WORK_INIT (   work,
  fn 
)
Value:
{ \
.node = LIST_HEAD_INIT((work).node), \
.func = (fn), \
}
#define LIST_HEAD_INIT(name)
Definition list.h:15

Typedef Documentation

◆ kthread_work_func_t

typedef void(* kthread_work_func_t) (struct kthread_work *work)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
KTW_FREEZABLE 

Function Documentation

◆ __kthread_init_worker()

void __kthread_init_worker ( struct kthread_worker *  worker,
const char *  name,
struct lock_class_key *  key 
)
extern

◆ __printf() [1/2]

__printf ( 3  ,
4   
)

◆ __printf() [2/2]

__printf ( 4  ,
5   
)

◆ free_kthread_struct()

void free_kthread_struct ( struct task_struct *  k)

◆ get_kthread_comm()

void get_kthread_comm ( char *  buf,
size_t  buf_size,
struct task_struct *  tsk 
)

◆ kthread_affine_preferred()

int kthread_affine_preferred ( struct task_struct *  p,
const struct cpumask *  mask 
)

◆ kthread_bind()

void kthread_bind ( struct task_struct *  k,
unsigned int  cpu 
)

◆ kthread_bind_mask()

void kthread_bind_mask ( struct task_struct *  k,
const struct cpumask *  mask 
)

◆ kthread_cancel_delayed_work_sync()

bool kthread_cancel_delayed_work_sync ( struct kthread_delayed_work *  work)

◆ kthread_cancel_work_sync()

bool kthread_cancel_work_sync ( struct kthread_work *  work)

◆ kthread_complete_and_exit()

void kthread_complete_and_exit ( struct completion *  ,
long   
)

◆ kthread_create_on_cpu()

struct task_struct * kthread_create_on_cpu ( int(*)(void *data)  threadfn,
void *  data,
unsigned int  cpu,
const char *  namefmt 
)

◆ kthread_create_worker_on_cpu()

struct kthread_worker * kthread_create_worker_on_cpu ( int  cpu,
unsigned int  flags,
const char  namefmt[] 
)

◆ kthread_data()

void * kthread_data ( struct task_struct *  k)

◆ kthread_delayed_work_timer_fn()

void kthread_delayed_work_timer_fn ( struct timer_list *  t)

◆ kthread_destroy_worker()

void kthread_destroy_worker ( struct kthread_worker *  worker)

◆ kthread_do_exit()

void kthread_do_exit ( struct kthread *  ,
long   
)

◆ kthread_flush_work()

void kthread_flush_work ( struct kthread_work *  work)

◆ kthread_flush_worker()

void kthread_flush_worker ( struct kthread_worker *  worker)

◆ kthread_freezable_should_stop()

bool kthread_freezable_should_stop ( bool *  was_frozen)

◆ kthread_func()

void * kthread_func ( struct task_struct *  k)

◆ kthread_is_per_cpu()

bool kthread_is_per_cpu ( struct task_struct *  k)

◆ kthread_mod_delayed_work()

bool kthread_mod_delayed_work ( struct kthread_worker *  worker,
struct kthread_delayed_work *  dwork,
unsigned long  delay 
)

◆ kthread_park()

int kthread_park ( struct task_struct *  k)

◆ kthread_parkme()

void kthread_parkme ( void  )

◆ kthread_probe_data()

void * kthread_probe_data ( struct task_struct *  k)

◆ kthread_queue_delayed_work()

bool kthread_queue_delayed_work ( struct kthread_worker *  worker,
struct kthread_delayed_work *  dwork,
unsigned long  delay 
)

◆ kthread_queue_work()

bool kthread_queue_work ( struct kthread_worker *  worker,
struct kthread_work *  work 
)

◆ kthread_set_per_cpu()

void kthread_set_per_cpu ( struct task_struct *  k,
int  cpu 
)

◆ kthread_should_park()

bool kthread_should_park ( void  )

◆ kthread_should_stop()

bool kthread_should_stop ( void  )

◆ kthread_should_stop_or_park()

bool kthread_should_stop_or_park ( void  )

◆ kthread_stop()

int kthread_stop ( struct task_struct *  k)

◆ kthread_stop_put()

int kthread_stop_put ( struct task_struct *  k)

◆ kthread_unpark()

void kthread_unpark ( struct task_struct *  k)

◆ kthread_unuse_mm()

void kthread_unuse_mm ( struct mm_struct *  mm)

◆ kthread_use_mm()

void kthread_use_mm ( struct mm_struct *  mm)

◆ kthread_worker_fn()

int kthread_worker_fn ( void *  worker_ptr)

◆ kthreadd()

int kthreadd ( void *  unused)

◆ kthreads_update_housekeeping()

int kthreads_update_housekeeping ( void  )

◆ set_kthread_struct()

bool set_kthread_struct ( struct task_struct *  p)

◆ tsk_fork_get_node()

int tsk_fork_get_node ( struct task_struct *  tsk)
extern

Variable Documentation

◆ data

void* data

◆ kthreadd_task

struct task_struct* kthreadd_task
extern

◆ namefmt

int const char namefmt

◆ node

int node