FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/libkern.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/epoch.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/gtaskqueue.h>
#include <sys/unistd.h>
#include <machine/stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | gtaskqueue_busy |
struct | gtaskqueue |
struct | taskqgroup_cpu |
struct | taskqgroup |
struct | taskq_bind_task |
Macros | |
#define | TQ_FLAGS_ACTIVE (1 << 0) |
#define | TQ_FLAGS_BLOCKED (1 << 1) |
#define | TQ_FLAGS_UNLOCKED_ENQUEUE (1 << 2) |
#define | DT_CALLOUT_ARMED (1 << 0) |
#define | TQ_LOCK(tq) |
#define | TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_OWNED) |
#define | TQ_UNLOCK(tq) |
#define | TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) |
Typedefs | |
typedef void(* | gtaskqueue_enqueue_fn) (void *context) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | MALLOC_DEFINE (M_GTASKQUEUE, "gtaskqueue", "Group Task Queues") |
static void | gtaskqueue_thread_enqueue (void *) |
static void | gtaskqueue_thread_loop (void *arg) |
static int | task_is_running (struct gtaskqueue *queue, struct gtask *gtask) |
static void | gtaskqueue_drain_locked (struct gtaskqueue *queue, struct gtask *gtask) |
TASKQGROUP_DEFINE (softirq, mp_ncpus, 1) | |
static __inline int | TQ_SLEEP (struct gtaskqueue *tq, void *p, const char *wm) |
static struct gtaskqueue * | _gtaskqueue_create (const char *name, int mflags, taskqueue_enqueue_fn enqueue, void *context, int mtxflags, const char *mtxname __unused) |
static void | gtaskqueue_terminate (struct thread **pp, struct gtaskqueue *tq) |
static void __unused | gtaskqueue_free (struct gtaskqueue *queue) |
void | grouptask_block (struct grouptask *grouptask) |
void | grouptask_unblock (struct grouptask *grouptask) |
int | grouptaskqueue_enqueue (struct gtaskqueue *queue, struct gtask *gtask) |
static void | gtaskqueue_task_nop_fn (void *context) |
static void | gtaskqueue_drain_tq_queue (struct gtaskqueue *queue) |
static void | gtaskqueue_drain_tq_active (struct gtaskqueue *queue) |
void | gtaskqueue_block (struct gtaskqueue *queue) |
void | gtaskqueue_unblock (struct gtaskqueue *queue) |
static void | gtaskqueue_run_locked (struct gtaskqueue *queue) |
static int | gtaskqueue_cancel_locked (struct gtaskqueue *queue, struct gtask *gtask) |
int | gtaskqueue_cancel (struct gtaskqueue *queue, struct gtask *gtask) |
void | gtaskqueue_drain (struct gtaskqueue *queue, struct gtask *gtask) |
void | gtaskqueue_drain_all (struct gtaskqueue *queue) |
static int | _gtaskqueue_start_threads (struct gtaskqueue **tqp, int count, int pri, cpuset_t *mask, const char *name, va_list ap) |
static int | gtaskqueue_start_threads (struct gtaskqueue **tqp, int count, int pri, const char *name,...) |
static void | gtaskqueue_run_callback (struct gtaskqueue *tq, enum taskqueue_callback_type cb_type) |
static struct gtaskqueue * | gtaskqueue_create_fast (const char *name, int mflags, taskqueue_enqueue_fn enqueue, void *context) |
static void | taskqgroup_cpu_create (struct taskqgroup *qgroup, int idx, int cpu) |
static int | taskqgroup_find (struct taskqgroup *qgroup, void *uniq) |
void | taskqgroup_attach (struct taskqgroup *qgroup, struct grouptask *gtask, void *uniq, device_t dev, struct resource *irq, const char *name) |
int | taskqgroup_attach_cpu (struct taskqgroup *qgroup, struct grouptask *gtask, void *uniq, int cpu, device_t dev, struct resource *irq, const char *name) |
void | taskqgroup_detach (struct taskqgroup *qgroup, struct grouptask *gtask) |
static void | taskqgroup_binder (void *ctx) |
void | taskqgroup_bind (struct taskqgroup *qgroup) |
struct taskqgroup * | taskqgroup_create (const char *name, int cnt, int stride) |
void | taskqgroup_destroy (struct taskqgroup *qgroup) |
void | taskqgroup_drain_all (struct taskqgroup *tqg) |
#define DT_CALLOUT_ARMED (1 << 0) |
Definition at line 88 of file subr_gtaskqueue.c.
#define TQ_ASSERT_LOCKED | ( | tq | ) | mtx_assert(&(tq)->tq_mutex, MA_OWNED) |
Definition at line 97 of file subr_gtaskqueue.c.
#define TQ_ASSERT_UNLOCKED | ( | tq | ) | mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) |
Definition at line 106 of file subr_gtaskqueue.c.
#define TQ_FLAGS_ACTIVE (1 << 0) |
Definition at line 84 of file subr_gtaskqueue.c.
#define TQ_FLAGS_BLOCKED (1 << 1) |
Definition at line 85 of file subr_gtaskqueue.c.
#define TQ_FLAGS_UNLOCKED_ENQUEUE (1 << 2) |
Definition at line 86 of file subr_gtaskqueue.c.
#define TQ_LOCK | ( | tq | ) |
Definition at line 90 of file subr_gtaskqueue.c.
#define TQ_UNLOCK | ( | tq | ) |
Definition at line 99 of file subr_gtaskqueue.c.
typedef void(* gtaskqueue_enqueue_fn) (void *context) |
Definition at line 65 of file subr_gtaskqueue.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 126 of file subr_gtaskqueue.c.
References free(), gtaskqueue_thread_enqueue(), malloc(), name, snprintf(), TQ_FLAGS_ACTIVE, and TQ_FLAGS_UNLOCKED_ENQUEUE.
Referenced by gtaskqueue_create_fast().
|
static |
Definition at line 449 of file subr_gtaskqueue.c.
References count, cpuset_setthread(), gtaskqueue_thread_loop(), kthread_add(), malloc(), mask, name, printf(), sched_add(), sched_prio(), and vsnprintf().
Referenced by gtaskqueue_start_threads().
void grouptask_block | ( | struct grouptask * | grouptask | ) |
Definition at line 191 of file subr_gtaskqueue.c.
References gtaskqueue_drain_locked(), panic(), TQ_LOCK, and TQ_UNLOCK.
Referenced by taskqgroup_detach().
void grouptask_unblock | ( | struct grouptask * | grouptask | ) |
Definition at line 209 of file subr_gtaskqueue.c.
References panic(), TQ_LOCK, and TQ_UNLOCK.
int grouptaskqueue_enqueue | ( | struct gtaskqueue * | queue, |
struct gtask * | gtask | ||
) |
Definition at line 226 of file subr_gtaskqueue.c.
References panic(), TQ_FLAGS_BLOCKED, TQ_LOCK, and TQ_UNLOCK.
Referenced by taskqgroup_bind().
void gtaskqueue_block | ( | struct gtaskqueue * | queue | ) |
Definition at line 323 of file subr_gtaskqueue.c.
References TQ_FLAGS_BLOCKED, TQ_LOCK, and TQ_UNLOCK.
int gtaskqueue_cancel | ( | struct gtaskqueue * | queue, |
struct gtask * | gtask | ||
) |
Definition at line 405 of file subr_gtaskqueue.c.
References gtaskqueue_cancel_locked(), TQ_LOCK, and TQ_UNLOCK.
|
static |
Definition at line 395 of file subr_gtaskqueue.c.
References task_is_running().
Referenced by gtaskqueue_cancel().
|
static |
Definition at line 585 of file subr_gtaskqueue.c.
References _gtaskqueue_create(), and name.
Referenced by taskqgroup_cpu_create().
void gtaskqueue_drain | ( | struct gtaskqueue * | queue, |
struct gtask * | gtask | ||
) |
Definition at line 424 of file subr_gtaskqueue.c.
References gtaskqueue_drain_locked(), TQ_LOCK, and TQ_UNLOCK.
void gtaskqueue_drain_all | ( | struct gtaskqueue * | queue | ) |
Definition at line 436 of file subr_gtaskqueue.c.
References gtaskqueue_drain_tq_active(), gtaskqueue_drain_tq_queue(), TQ_LOCK, and TQ_UNLOCK.
Referenced by taskqgroup_drain_all().
|
static |
Definition at line 417 of file subr_gtaskqueue.c.
References task_is_running(), and TQ_SLEEP().
Referenced by grouptask_block(), and gtaskqueue_drain().
|
static |
Definition at line 295 of file subr_gtaskqueue.c.
References gtaskqueue_busy::tb_running, gtaskqueue_busy::tb_seq, TQ_FLAGS_ACTIVE, TQ_SLEEP(), and wakeup_one().
Referenced by gtaskqueue_drain_all().
|
static |
Definition at line 262 of file subr_gtaskqueue.c.
References gtaskqueue_task_nop_fn(), and TQ_SLEEP().
Referenced by gtaskqueue_drain_all().
|
static |
Definition at line 173 of file subr_gtaskqueue.c.
References free(), gtaskqueue_terminate(), and TQ_LOCK.
|
inlinestatic |
Definition at line 525 of file subr_gtaskqueue.c.
References TQ_ASSERT_UNLOCKED.
Referenced by gtaskqueue_thread_loop().
|
static |
Definition at line 343 of file subr_gtaskqueue.c.
References gtaskqueue_busy::tb_running, gtaskqueue_busy::tb_seq, TQ_ASSERT_LOCKED, TQ_LOCK, TQ_UNLOCK, and wakeup().
Referenced by gtaskqueue_thread_loop().
|
static |
Definition at line 512 of file subr_gtaskqueue.c.
References _gtaskqueue_start_threads(), count, and name.
Referenced by taskqgroup_cpu_create().
|
static |
Definition at line 252 of file subr_gtaskqueue.c.
Referenced by gtaskqueue_drain_tq_queue().
|
static |
Definition at line 163 of file subr_gtaskqueue.c.
References TQ_SLEEP(), and wakeup().
Referenced by gtaskqueue_free().
|
static |
Definition at line 575 of file subr_gtaskqueue.c.
References wakeup_any().
Referenced by _gtaskqueue_create().
|
static |
Definition at line 537 of file subr_gtaskqueue.c.
References gtaskqueue_run_callback(), gtaskqueue_run_locked(), kthread_exit(), TQ_FLAGS_ACTIVE, TQ_LOCK, TQ_SLEEP(), TQ_UNLOCK, and wakeup_one().
Referenced by _gtaskqueue_start_threads().
void gtaskqueue_unblock | ( | struct gtaskqueue * | queue | ) |
Definition at line 332 of file subr_gtaskqueue.c.
|
static |
|
static |
Definition at line 382 of file subr_gtaskqueue.c.
References gtaskqueue_busy::tb_running, and TQ_ASSERT_LOCKED.
Referenced by gtaskqueue_cancel_locked(), and gtaskqueue_drain_locked().
void taskqgroup_attach | ( | struct taskqgroup * | qgroup, |
struct grouptask * | gtask, | ||
void * | uniq, | ||
device_t | dev, | ||
struct resource * | irq, | ||
const char * | name | ||
) |
Definition at line 669 of file subr_gtaskqueue.c.
References bus_bind_intr(), name, printf(), snprintf(), taskqgroup_find(), taskqgroup::tqg_cnt, taskqgroup::tqg_lock, taskqgroup::tqg_name, and taskqgroup::tqg_queue.
int taskqgroup_attach_cpu | ( | struct taskqgroup * | qgroup, |
struct grouptask * | gtask, | ||
void * | uniq, | ||
int | cpu, | ||
device_t | dev, | ||
struct resource * | irq, | ||
const char * | name | ||
) |
Definition at line 700 of file subr_gtaskqueue.c.
References bus_bind_intr(), name, printf(), snprintf(), taskqgroup::tqg_cnt, taskqgroup::tqg_lock, and taskqgroup::tqg_queue.
Referenced by epoch_init().
void taskqgroup_bind | ( | struct taskqgroup * | qgroup | ) |
Definition at line 776 of file subr_gtaskqueue.c.
References taskq_bind_task::bt_cpuid, taskq_bind_task::bt_task, grouptaskqueue_enqueue(), malloc(), taskqgroup_binder(), taskqgroup::tqg_cnt, and taskqgroup::tqg_queue.
|
static |
Definition at line 756 of file subr_gtaskqueue.c.
References taskq_bind_task::bt_cpuid, cpuset_setthread(), free(), mask, printf(), and sched_bind().
Referenced by taskqgroup_bind().
|
static |
Definition at line 612 of file subr_gtaskqueue.c.
References gtaskqueue_create_fast(), gtaskqueue_start_threads(), taskqueue_thread_enqueue(), taskqgroup::tqg_name, and taskqgroup::tqg_queue.
Referenced by taskqgroup_create().
struct taskqgroup * taskqgroup_create | ( | const char * | name, |
int | cnt, | ||
int | stride | ||
) |
Definition at line 798 of file subr_gtaskqueue.c.
References malloc(), name, taskqgroup_cpu_create(), taskqgroup::tqg_cnt, taskqgroup::tqg_lock, and taskqgroup::tqg_name.
TASKQGROUP_DEFINE | ( | softirq | , |
mp_ncpus | , | ||
1 | |||
) |
void taskqgroup_destroy | ( | struct taskqgroup * | qgroup | ) |
Definition at line 817 of file subr_gtaskqueue.c.
void taskqgroup_detach | ( | struct taskqgroup * | qgroup, |
struct grouptask * | gtask | ||
) |
Definition at line 737 of file subr_gtaskqueue.c.
References grouptask_block(), panic(), taskqgroup::tqg_cnt, taskqgroup::tqg_lock, and taskqgroup::tqg_queue.
void taskqgroup_drain_all | ( | struct taskqgroup * | tqg | ) |
Definition at line 822 of file subr_gtaskqueue.c.
References gtaskqueue_drain_all(), mp_ncpus, and taskqgroup::tqg_queue.
|
static |
Definition at line 630 of file subr_gtaskqueue.c.
References panic(), taskqgroup::tqg_cnt, taskqgroup::tqg_lock, taskqgroup::tqg_name, and taskqgroup::tqg_queue.
Referenced by taskqgroup_attach().
|
static |
Definition at line 118 of file subr_gtaskqueue.c.
References mtx.
Referenced by gtaskqueue_drain_locked(), gtaskqueue_drain_tq_active(), gtaskqueue_drain_tq_queue(), gtaskqueue_terminate(), and gtaskqueue_thread_loop().