Linux Kernel
3.7.1
|
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/cpuset.h>
#include <linux/unistd.h>
#include <linux/file.h>
#include <linux/export.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/freezer.h>
#include <linux/ptrace.h>
#include <trace/events/sched.h>
Go to the source code of this file.
Data Structures | |
struct | kthread_create_info |
struct | kthread |
struct | kthread_flush_work |
Macros | |
#define | to_kthread(tsk) container_of((tsk)->vfork_done, struct kthread, exited) |
Enumerations | |
enum | KTHREAD_BITS { KTHREAD_IS_PER_CPU = 0, KTHREAD_SHOULD_STOP, KTHREAD_SHOULD_PARK, KTHREAD_IS_PARKED } |
Variables | |
struct task_struct * | kthreadd_task |
#define to_kthread | ( | tsk | ) | container_of((tsk)->vfork_done, struct kthread, exited) |
enum KTHREAD_BITS |
void __init_kthread_worker | ( | struct kthread_worker * | worker, |
const char * | name, | ||
struct lock_class_key * | key | ||
) |
EXPORT_SYMBOL | ( | kthread_should_stop | ) |
EXPORT_SYMBOL | ( | kthread_create_on_node | ) |
EXPORT_SYMBOL | ( | kthread_bind | ) |
EXPORT_SYMBOL | ( | kthread_stop | ) |
EXPORT_SYMBOL_GPL | ( | kthread_freezable_should_stop | ) |
EXPORT_SYMBOL_GPL | ( | __init_kthread_worker | ) |
EXPORT_SYMBOL_GPL | ( | kthread_worker_fn | ) |
EXPORT_SYMBOL_GPL | ( | queue_kthread_work | ) |
EXPORT_SYMBOL_GPL | ( | flush_kthread_work | ) |
EXPORT_SYMBOL_GPL | ( | flush_kthread_worker | ) |
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.
|
read |
kthread_create_on_node - create a kthread. : the function to run until signal_pending(current). : data ptr for . : memory node number. : printf-style name for the thread.
Description: This helper function creates and names a kernel thread. The thread will be stopped: use wake_up_process() to start it. See also kthread_run().
If thread is going to be bound on a particular cpu, give its node in , to get NUMA affinity for kthread stack, or else give -1. When woken, the thread will run () with as its argument. () can either call do_exit() directly if it is a standalone thread for which no one will call kthread_stop(), or return when 'kthread_should_stop()' is true (which means kthread_stop() has been called). The return value should be zero or a negative error number; it will be passed to kthread_stop().
Returns a task_struct or ERR_PTR(-ENOMEM).
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 |