Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | kthread_worker |
struct | kthread_work |
Macros | |
#define | kthread_create(threadfn, data, namefmt, arg...) kthread_create_on_node(threadfn, data, -1, namefmt, ##arg) |
#define | kthread_run(threadfn, data, namefmt,...) |
#define | KTHREAD_WORKER_INIT(worker) |
#define | KTHREAD_WORK_INIT(work, fn) |
#define | DEFINE_KTHREAD_WORKER(worker) struct kthread_worker worker = KTHREAD_WORKER_INIT(worker) |
#define | DEFINE_KTHREAD_WORK(work, fn) struct kthread_work work = KTHREAD_WORK_INIT(work, fn) |
#define | DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) |
#define | DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn) |
#define | init_kthread_worker(worker) |
#define | init_kthread_work(work, fn) |
Typedefs | |
typedef void(* | kthread_work_func_t )(struct kthread_work *work) |
Variables | |
void * | data |
void int | node |
void int const char | namefmt [] |
struct task_struct * | kthreadd_task |
#define DEFINE_KTHREAD_WORK | ( | work, | |
fn | |||
) | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) |
#define DEFINE_KTHREAD_WORK_ONSTACK | ( | work, | |
fn | |||
) | DEFINE_KTHREAD_WORK(work, fn) |
#define DEFINE_KTHREAD_WORKER | ( | worker | ) | struct kthread_worker worker = KTHREAD_WORKER_INIT(worker) |
#define DEFINE_KTHREAD_WORKER_ONSTACK | ( | worker | ) | DEFINE_KTHREAD_WORKER(worker) |
#define init_kthread_worker | ( | worker | ) |
kthread_run - create and wake a thread. : the function to run until signal_pending(current). : data ptr for . : 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_WORKER_INIT | ( | worker | ) |
typedef void(* kthread_work_func_t)(struct kthread_work *work) |
void __init_kthread_worker | ( | struct kthread_worker * | worker, |
const char * | name, | ||
struct lock_class_key * | key | ||
) |
__printf | ( | 4 | , |
5 | |||
) |
void flush_kthread_work | ( | struct kthread_work * | work | ) |
flush_kthread_work - flush a kthread_work : work to flush
If is queued or executing, wait for it to finish execution.
void flush_kthread_worker | ( | struct kthread_worker * | worker | ) |
flush_kthread_worker - flush all current works on a kthread_worker : worker to flush
Wait until all currently executing or pending works on are finished.
void kthread_bind | ( | struct task_struct * | p, |
unsigned int | cpu | ||
) |
kthread_bind - bind a just-created kthread to a cpu. : thread created by kthread_create(). : cpu (might not be online, must be possible) for to run on.
Description: This function is equivalent to set_cpus_allowed(), except that doesn't need to be online, and the thread must be stopped (i.e., just returned from kthread_create()).
|
read |
kthread_create_on_cpu - Create a cpu bound kthread : the function to run until signal_pending(current). : data ptr for . : The cpu on which the thread should be bound, : printf-style name for the thread. Format is restricted to "name.*%u". Code fills in cpu number.
Description: This helper function creates and names a kernel thread The thread will be woken and put into park mode.
void* kthread_data | ( | struct task_struct * | task | ) |
kthread_freezable_should_stop - should this freezable kthread return now? : optional out parameter, indicates whether current was frozen
kthread_should_stop() for freezable kthreads, which will enter refrigerator if necessary. This function is safe from kthread_stop() / freezer deadlock and freezable kthreads should use this function instead of calling try_to_freeze() directly.
int kthread_park | ( | struct task_struct * | k | ) |
kthread_park - park a thread created by kthread_create(). : thread created by kthread_create().
Sets kthread_should_park() for to return true, wakes it, and waits for it to return. This can also be called after kthread_create() instead of calling wake_up_process(): the thread will park without calling threadfn().
Returns 0 if the thread is parked, -ENOSYS if the thread exited. If called by the kthread itself just the park bit is set.
kthread_should_park - should this kthread park now?
When someone calls kthread_park() on your kthread, it will be woken and this will return true. You should then do the necessary cleanup and call kthread_parkme()
Similar to kthread_should_stop(), but this keeps the thread alive and in a park position. kthread_unpark() "restarts" the thread and calls the thread function again.
kthread_should_stop - should this kthread return now?
When someone calls kthread_stop() on your kthread, it will be woken and this will return true. You should then return, and your return value will be passed through to kthread_stop().
int kthread_stop | ( | struct task_struct * | k | ) |
kthread_stop - stop a thread created by kthread_create(). : thread created by kthread_create().
Sets kthread_should_stop() for to return true, wakes it, and waits for it to exit. This can also be called after kthread_create() instead of calling wake_up_process(): the thread will exit without calling threadfn().
If threadfn() may call do_exit() itself, the caller must ensure task_struct can't go away.
Returns the result of threadfn(), or %-EINTR if wake_up_process() was never called.
void kthread_unpark | ( | struct task_struct * | k | ) |
kthread_unpark - unpark a thread created by kthread_create(). : thread created by kthread_create().
Sets kthread_should_park() for to return false, wakes it, and waits for it to return. If the thread is marked percpu then its bound to the cpu again.
kthread_worker_fn - kthread function to process kthread_worker : pointer to initialized kthread_worker
This function can be used as to kthread_create() or kthread_run() with argument pointing to an initialized 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.
bool queue_kthread_work | ( | struct kthread_worker * | worker, |
struct kthread_work * | work | ||
) |
queue_kthread_work - queue a kthread_work : target kthread_worker : kthread_work to queue
Queue to work processor for async execution. must have been created with kthread_worker_create(). Returns true if was successfully queued, false if it was already pending.
int tsk_fork_get_node | ( | struct task_struct * | tsk | ) |
struct task_struct* kthreadd_task |