FreeBSD kernel kern code
kern_cpuset.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/ctype.h>
#include <sys/sysproto.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/refcount.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/syscallsubr.h>
#include <sys/capsicum.h>
#include <sys/cpuset.h>
#include <sys/domainset.h>
#include <sys/sx.h>
#include <sys/queue.h>
#include <sys/libkern.h>
#include <sys/limits.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/vmmeter.h>
#include <vm/uma.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
#include <vm/vm_phys.h>
#include <vm/vm_pagequeue.h>
Include dependency graph for kern_cpuset.c:

Go to the source code of this file.

Data Structures

struct  cpuset_args
 
struct  cpuset_setid_args
 
struct  cpuset_getid_args
 
struct  cpuset_getaffinity_args
 
struct  cpuset_setaffinity_args
 
struct  cpuset_getdomain_args
 
struct  cpuset_setdomain_args
 

Functions

 __FBSDID ("$FreeBSD$")
 
 LIST_HEAD (domainlist, domainset)
 
 SYSCTL_INT (_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD|CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, sizeof(cpuset_t), "sizeof(cpuset_t)")
 
static int domainset_valid (const struct domainset *, const struct domainset *)
 
static struct cpuset * cpuset_getbase (struct cpuset *set)
 
static struct cpuset * cpuset_getroot (struct cpuset *set)
 
struct cpuset * cpuset_ref (struct cpuset *set)
 
static struct cpuset * cpuset_refroot (struct cpuset *set)
 
static struct cpuset * cpuset_refbase (struct cpuset *set)
 
void cpuset_rel (struct cpuset *set)
 
static void cpuset_rel_defer (struct setlist *head, struct cpuset *set)
 
static void cpuset_rel_complete (struct cpuset *set)
 
static struct cpuset * cpuset_lookup (cpusetid_t setid, struct thread *td)
 
static int cpuset_init (struct cpuset *set, struct cpuset *parent, const cpuset_t *mask, struct domainset *domain, cpusetid_t id)
 
static int cpuset_create (struct cpuset **setp, struct cpuset *parent, const cpuset_t *mask)
 
static void cpuset_freelist_add (struct setlist *list, int count)
 
static void cpuset_freelist_init (struct setlist *list, int count)
 
static void cpuset_freelist_free (struct setlist *list)
 
static void domainset_freelist_add (struct domainlist *list, int count)
 
static void domainset_freelist_init (struct domainlist *list, int count)
 
static void domainset_freelist_free (struct domainlist *list)
 
static void domainset_copy (const struct domainset *from, struct domainset *to)
 
static int domainset_equal (const struct domainset *one, const struct domainset *two)
 
static int domainset_restrict (const struct domainset *parent, const struct domainset *child)
 
static struct domainset * _domainset_create (struct domainset *domain, struct domainlist *freelist)
 
static bool domainset_empty_vm (struct domainset *domain)
 
struct domainset * domainset_create (const struct domainset *domain)
 
static void domainset_notify (void)
 
static struct domainset * domainset_shadow (const struct domainset *pdomain, const struct domainset *domain, struct domainlist *freelist)
 
static int cpuset_testupdate (struct cpuset *set, cpuset_t *mask, int augment_mask)
 
static void cpuset_update (struct cpuset *set, cpuset_t *mask)
 
static int cpuset_modify (struct cpuset *set, cpuset_t *mask)
 
static int cpuset_testupdate_domain (struct cpuset *set, struct domainset *dset, struct domainset *orig, int *count, int augment_mask __unused)
 
static void cpuset_update_domain (struct cpuset *set, struct domainset *domain, struct domainset *orig, struct domainlist *domains)
 
static int cpuset_modify_domain (struct cpuset *set, struct domainset *domain)
 
int cpuset_which (cpuwhich_t which, id_t id, struct proc **pp, struct thread **tdp, struct cpuset **setp)
 
static int cpuset_testshadow (struct cpuset *set, const cpuset_t *mask, const struct domainset *domain)
 
static int cpuset_shadow (struct cpuset *set, struct cpuset **nsetp, const cpuset_t *mask, const struct domainset *domain, struct setlist *cpusets, struct domainlist *domains)
 
static struct cpuset * cpuset_update_thread (struct thread *td, struct cpuset *nset)
 
static int cpuset_setproc_test_maskthread (struct cpuset *tdset, cpuset_t *mask, struct domainset *domain)
 
static int cpuset_setproc_maskthread (struct cpuset *tdset, cpuset_t *mask, struct domainset *domain, struct cpuset **nsetp, struct setlist *freelist, struct domainlist *domainlist)
 
static int cpuset_setproc_setthread_mask (struct cpuset *tdset, struct cpuset *set, cpuset_t *mask, struct domainset *domain)
 
static int cpuset_setproc_test_setthread (struct cpuset *tdset, struct cpuset *set)
 
static int cpuset_setproc_setthread (struct cpuset *tdset, struct cpuset *set, struct cpuset **nsetp, struct setlist *freelist, struct domainlist *domainlist)
 
static int cpuset_setproc_newbase (struct thread *td, struct cpuset *set, struct cpuset *nroot, struct cpuset **nsetp, struct setlist *cpusets, struct domainlist *domainlist)
 
static int cpuset_setproc (pid_t pid, struct cpuset *set, cpuset_t *mask, struct domainset *domain, bool rebase)
 
static int bitset_strprint (char *buf, size_t bufsiz, const struct bitset *set, int setlen)
 
static int bitset_strscan (struct bitset *set, int setlen, const char *buf)
 
char * cpusetobj_strprint (char *buf, const cpuset_t *set)
 
int cpusetobj_strscan (cpuset_t *set, const char *buf)
 
int sysctl_handle_domainset (SYSCTL_HANDLER_ARGS)
 
static int _cpuset_setthread (lwpid_t id, cpuset_t *mask, struct domainset *domain)
 
int cpuset_setthread (lwpid_t id, cpuset_t *mask)
 
int cpuset_setithread (lwpid_t id, int cpu)
 
void domainset_init (void)
 
void domainset_zero (void)
 
struct cpuset * cpuset_thread0 (void)
 
void cpuset_kernthread (struct thread *td)
 
int cpuset_create_root (struct prison *pr, struct cpuset **setp)
 
int cpuset_setproc_update_set (struct proc *p, struct cpuset *set)
 
static int cpuset_check_capabilities (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id)
 
int sys_cpuset (struct thread *td, struct cpuset_args *uap)
 
int sys_cpuset_setid (struct thread *td, struct cpuset_setid_args *uap)
 
int kern_cpuset_setid (struct thread *td, cpuwhich_t which, id_t id, cpusetid_t setid)
 
int sys_cpuset_getid (struct thread *td, struct cpuset_getid_args *uap)
 
int kern_cpuset_getid (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid)
 
int sys_cpuset_getaffinity (struct thread *td, struct cpuset_getaffinity_args *uap)
 
int kern_cpuset_getaffinity (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp)
 
int sys_cpuset_setaffinity (struct thread *td, struct cpuset_setaffinity_args *uap)
 
int kern_cpuset_setaffinity (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *maskp)
 
int sys_cpuset_getdomain (struct thread *td, struct cpuset_getdomain_args *uap)
 
int kern_cpuset_getdomain (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *maskp, int *policyp)
 
int sys_cpuset_setdomain (struct thread *td, struct cpuset_setdomain_args *uap)
 
int kern_cpuset_setdomain (struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, const domainset_t *maskp, int policy)
 

Variables

struct domainset __read_mostly domainset_firsttouch
 
struct domainset __read_mostly domainset_fixed [MAXMEMDOM]
 
struct domainset __read_mostly domainset_interleave
 
struct domainset __read_mostly domainset_prefer [MAXMEMDOM]
 
struct domainset __read_mostly domainset_roundrobin
 
static uma_zone_t cpuset_zone
 
static uma_zone_t domainset_zone
 
static struct mtx cpuset_lock
 
static struct setlist cpuset_ids
 
static struct domainlist cpuset_domains
 
static struct unrhdr * cpuset_unr
 
static struct cpuset * cpuset_zero
 
static struct cpuset * cpuset_default
 
static struct cpuset * cpuset_kernel
 
static struct domainset * domainset0
 
static struct domainset * domainset2
 
cpuset_t * cpuset_root
 
cpuset_t cpuset_domain [MAXMEMDOM]
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _cpuset_setthread()

static int _cpuset_setthread ( lwpid_t  id,
cpuset_t *  mask,
struct domainset *  domain 
)
static

Definition at line 1467 of file kern_cpuset.c.

References cpuset_freelist_free(), cpuset_freelist_init(), cpuset_rel(), cpuset_shadow(), cpuset_update_thread(), cpuset_which(), domain, domainset_freelist_free(), domainset_freelist_init(), mask, and set.

Referenced by cpuset_setithread(), cpuset_setthread(), and kern_cpuset_setdomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _domainset_create()

static struct domainset * _domainset_create ( struct domainset *  domain,
struct domainlist *  freelist 
)
static

Definition at line 482 of file kern_cpuset.c.

References cpuset_domains, cpuset_lock, domain, domainset_equal(), and domainset_zone.

Referenced by domainset_create(), domainset_init(), and domainset_shadow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitset_strprint()

static int bitset_strprint ( char *  buf,
size_t  bufsiz,
const struct bitset *  set,
int  setlen 
)
static

Definition at line 1331 of file kern_cpuset.c.

References buf, set, and snprintf().

Referenced by cpusetobj_strprint(), and sysctl_handle_domainset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitset_strscan()

static int bitset_strscan ( struct bitset *  set,
int  setlen,
const char *  buf 
)
static

Definition at line 1358 of file kern_cpuset.c.

References buf, set, and sscanf().

Referenced by cpusetobj_strscan(), and sysctl_handle_domainset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_check_capabilities()

static int cpuset_check_capabilities ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id 
)
static

Definition at line 1727 of file kern_cpuset.c.

References level.

Referenced by kern_cpuset_getaffinity(), kern_cpuset_getdomain(), kern_cpuset_setaffinity(), and kern_cpuset_setdomain().

Here is the caller graph for this function:

◆ cpuset_create()

static int cpuset_create ( struct cpuset **  setp,
struct cpuset *  parent,
const cpuset_t *  mask 
)
static

Definition at line 350 of file kern_cpuset.c.

References alloc_unr(), cpuset_init(), cpuset_unr, cpuset_zone, free_unr(), mask, parent, and set.

Referenced by cpuset_create_root(), cpuset_setproc_newbase(), and sys_cpuset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_create_root()

int cpuset_create_root ( struct prison *  pr,
struct cpuset **  setp 
)

Definition at line 1683 of file kern_cpuset.c.

References cpuset_create(), pr, and set.

Referenced by kern_jail_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_freelist_add()

static void cpuset_freelist_add ( struct setlist *  list,
int  count 
)
static

Definition at line 376 of file kern_cpuset.c.

References count, cpuset_zone, and set.

Referenced by cpuset_freelist_init(), and cpuset_setproc().

Here is the caller graph for this function:

◆ cpuset_freelist_free()

static void cpuset_freelist_free ( struct setlist *  list)
static

Definition at line 396 of file kern_cpuset.c.

References cpuset_zone, and set.

Referenced by _cpuset_setthread(), and cpuset_setproc().

Here is the caller graph for this function:

◆ cpuset_freelist_init()

static void cpuset_freelist_init ( struct setlist *  list,
int  count 
)
static

Definition at line 388 of file kern_cpuset.c.

References count, and cpuset_freelist_add().

Referenced by _cpuset_setthread(), and cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_getbase()

static struct cpuset * cpuset_getbase ( struct cpuset *  set)
static

◆ cpuset_getroot()

static struct cpuset * cpuset_getroot ( struct cpuset *  set)
static

Definition at line 162 of file kern_cpuset.c.

References set.

Referenced by cpuset_modify(), cpuset_modify_domain(), cpuset_refroot(), and cpuset_setproc().

Here is the caller graph for this function:

◆ cpuset_init()

static int cpuset_init ( struct cpuset *  set,
struct cpuset *  parent,
const cpuset_t *  mask,
struct domainset *  domain,
cpusetid_t  id 
)
static

Definition at line 310 of file kern_cpuset.c.

References cpuset_ids, cpuset_lock, cpuset_ref(), domain, domainset_valid(), mask, parent, and set.

Referenced by cpuset_create(), cpuset_shadow(), and cpuset_thread0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_kernthread()

void cpuset_kernthread ( struct thread *  td)

Definition at line 1662 of file kern_cpuset.c.

References cpuset_kernel, cpuset_ref(), cpuset_rel(), and set.

Referenced by kproc_create(), and kthread_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_lookup()

static struct cpuset * cpuset_lookup ( cpusetid_t  setid,
struct thread *  td 
)
static

Definition at line 273 of file kern_cpuset.c.

References cpuset_ids, cpuset_lock, cpuset_ref(), cpuset_rel(), and set.

Referenced by cpuset_which(), and kern_cpuset_setid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_modify()

static int cpuset_modify ( struct cpuset *  set,
cpuset_t *  mask 
)
static

Definition at line 683 of file kern_cpuset.c.

References cpuset_getroot(), cpuset_lock, cpuset_testupdate(), cpuset_update(), mask, priv_check(), and set.

Referenced by kern_cpuset_setaffinity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_modify_domain()

static int cpuset_modify_domain ( struct cpuset *  set,
struct domainset *  domain 
)
static

◆ cpuset_ref()

◆ cpuset_refbase()

static struct cpuset * cpuset_refbase ( struct cpuset *  set)
static

Definition at line 198 of file kern_cpuset.c.

References cpuset_getbase(), cpuset_ref(), and set.

Referenced by cpuset_which(), kern_cpuset_getaffinity(), kern_cpuset_getdomain(), kern_cpuset_getid(), kern_cpuset_setaffinity(), and kern_cpuset_setdomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_refroot()

static struct cpuset * cpuset_refroot ( struct cpuset *  set)
static

Definition at line 186 of file kern_cpuset.c.

References cpuset_getroot(), cpuset_ref(), and set.

Referenced by kern_cpuset_getaffinity(), kern_cpuset_getdomain(), kern_cpuset_getid(), kern_cpuset_setaffinity(), kern_cpuset_setdomain(), and sys_cpuset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_rel()

◆ cpuset_rel_complete()

static void cpuset_rel_complete ( struct cpuset *  set)
static

Definition at line 257 of file kern_cpuset.c.

References cpuset_rel(), cpuset_unr, cpuset_zone, free_unr(), and set.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_rel_defer()

static void cpuset_rel_defer ( struct setlist *  head,
struct cpuset *  set 
)
static

Definition at line 235 of file kern_cpuset.c.

References cpuset_lock, and set.

Referenced by cpuset_setproc().

Here is the caller graph for this function:

◆ cpuset_setithread()

int cpuset_setithread ( lwpid_t  id,
int  cpu 
)

Definition at line 1512 of file kern_cpuset.c.

References _cpuset_setthread(), cpuset_root, and mask.

Referenced by _intr_event_bind(), and start_softclock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc()

◆ cpuset_setproc_maskthread()

static int cpuset_setproc_maskthread ( struct cpuset *  tdset,
cpuset_t *  mask,
struct domainset *  domain,
struct cpuset **  nsetp,
struct setlist *  freelist,
struct domainlist *  domainlist 
)
static

Definition at line 1057 of file kern_cpuset.c.

References cpuset_getbase(), cpuset_shadow(), domain, mask, and parent.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_newbase()

static int cpuset_setproc_newbase ( struct thread *  td,
struct cpuset *  set,
struct cpuset *  nroot,
struct cpuset **  nsetp,
struct setlist *  cpusets,
struct domainlist *  domainlist 
)
static

Definition at line 1142 of file kern_cpuset.c.

References cpuset_create(), cpuset_getbase(), domainset_copy(), domainset_shadow(), and set.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_setthread()

static int cpuset_setproc_setthread ( struct cpuset *  tdset,
struct cpuset *  set,
struct cpuset **  nsetp,
struct setlist *  freelist,
struct domainlist *  domainlist 
)
static

Definition at line 1117 of file kern_cpuset.c.

References cpuset_ref(), cpuset_setproc_setthread_mask(), cpuset_shadow(), domain, mask, and set.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_setthread_mask()

static int cpuset_setproc_setthread_mask ( struct cpuset *  tdset,
struct cpuset *  set,
cpuset_t *  mask,
struct domainset *  domain 
)
static

Definition at line 1073 of file kern_cpuset.c.

References cpuset_getbase(), domain, domainset_copy(), mask, parent, and set.

Referenced by cpuset_setproc_setthread(), and cpuset_setproc_test_setthread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_test_maskthread()

static int cpuset_setproc_test_maskthread ( struct cpuset *  tdset,
cpuset_t *  mask,
struct domainset *  domain 
)
static

Definition at line 1043 of file kern_cpuset.c.

References cpuset_getbase(), cpuset_testshadow(), domain, mask, and parent.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_test_setthread()

static int cpuset_setproc_test_setthread ( struct cpuset *  tdset,
struct cpuset *  set 
)
static

Definition at line 1106 of file kern_cpuset.c.

References cpuset_setproc_setthread_mask(), domain, mask, and set.

Referenced by cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setproc_update_set()

int cpuset_setproc_update_set ( struct proc *  p,
struct cpuset *  set 
)

Definition at line 1707 of file kern_cpuset.c.

References cpuset_ref(), cpuset_rel(), cpuset_setproc(), and set.

Referenced by do_jail_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_setthread()

int cpuset_setthread ( lwpid_t  id,
cpuset_t *  mask 
)

Definition at line 1502 of file kern_cpuset.c.

References _cpuset_setthread(), and mask.

Referenced by _gtaskqueue_start_threads(), _taskqueue_start_threads(), intr_event_bind_ithread_cpuset(), kern_cpuset_setaffinity(), ktls_bind_domain(), ktls_work_thread(), and taskqgroup_binder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_shadow()

static int cpuset_shadow ( struct cpuset *  set,
struct cpuset **  nsetp,
const cpuset_t *  mask,
const struct domainset *  domain,
struct setlist *  cpusets,
struct domainlist *  domains 
)
static

Definition at line 998 of file kern_cpuset.c.

References cpuset_getbase(), cpuset_init(), cpuset_testshadow(), domain, domainset_shadow(), mask, parent, and set.

Referenced by _cpuset_setthread(), cpuset_setproc_maskthread(), and cpuset_setproc_setthread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_testshadow()

static int cpuset_testshadow ( struct cpuset *  set,
const cpuset_t *  mask,
const struct domainset *  domain 
)
static

Definition at line 967 of file kern_cpuset.c.

References cpuset_getbase(), domain, domainset_valid(), mask, parent, and set.

Referenced by cpuset_setproc_test_maskthread(), and cpuset_shadow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_testupdate()

static int cpuset_testupdate ( struct cpuset *  set,
cpuset_t *  mask,
int  augment_mask 
)
static

Definition at line 638 of file kern_cpuset.c.

References cpuset_lock, cpuset_testupdate(), mask, and set.

Referenced by cpuset_modify(), and cpuset_testupdate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_testupdate_domain()

static int cpuset_testupdate_domain ( struct cpuset *  set,
struct domainset *  dset,
struct domainset *  orig,
int *  count,
int augment_mask  __unused 
)
static

Definition at line 742 of file kern_cpuset.c.

References count, cpuset_lock, cpuset_testupdate_domain(), domain, domainset_copy(), domainset_equal(), domainset_restrict(), and set.

Referenced by cpuset_modify_domain(), and cpuset_testupdate_domain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_thread0()

struct cpuset * cpuset_thread0 ( void  )

Definition at line 1602 of file kern_cpuset.c.

References all_cpus, cpuset_default, cpuset_domain, cpuset_ids, cpuset_init(), cpuset_kernel, cpuset_root, cpuset_unr, cpuset_zero, cpuset_zone, domainset0, domainset2, domainset_zone, new_unrhdr(), and set.

Referenced by proc0_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_update()

static void cpuset_update ( struct cpuset *  set,
cpuset_t *  mask 
)
static

Definition at line 665 of file kern_cpuset.c.

References cpuset_lock, cpuset_update(), mask, and set.

Referenced by cpuset_modify(), and cpuset_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_update_domain()

static void cpuset_update_domain ( struct cpuset *  set,
struct domainset *  domain,
struct domainset *  orig,
struct domainlist *  domains 
)
static

Definition at line 774 of file kern_cpuset.c.

References cpuset_lock, cpuset_update_domain(), domain, domainset_shadow(), and set.

Referenced by cpuset_modify_domain(), and cpuset_update_domain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_update_thread()

static struct cpuset * cpuset_update_thread ( struct thread *  td,
struct cpuset *  nset 
)
static

Definition at line 1030 of file kern_cpuset.c.

References sched_affinity().

Referenced by _cpuset_setthread(), and cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpuset_which()

int cpuset_which ( cpuwhich_t  which,
id_t  id,
struct proc **  pp,
struct thread **  tdp,
struct cpuset **  setp 
)

◆ cpusetobj_strprint()

char * cpusetobj_strprint ( char *  buf,
const cpuset_t *  set 
)

Definition at line 1384 of file kern_cpuset.c.

References bitset_strprint(), buf, and set.

Referenced by sysctl_debug_ktr_cpumask().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpusetobj_strscan()

int cpusetobj_strscan ( cpuset_t *  set,
const char *  buf 
)

Definition at line 1397 of file kern_cpuset.c.

References bitset_strscan(), buf, and set.

Referenced by sysctl_debug_ktr_cpumask().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ domainset_copy()

static void domainset_copy ( const struct domainset *  from,
struct domainset *  to 
)
static

◆ domainset_create()

struct domainset * domainset_create ( const struct domainset *  domain)

Definition at line 558 of file kern_cpuset.c.

References _domainset_create(), domain, domainset0, domainset_copy(), and domainset_zone.

Referenced by cpuset_modify_domain(), and sysctl_handle_domainset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ domainset_empty_vm()

static bool domainset_empty_vm ( struct domainset *  domain)
static

Definition at line 525 of file kern_cpuset.c.

References domain, and empty.

Referenced by domainset_zero(), and kern_cpuset_setdomain().

Here is the caller graph for this function:

◆ domainset_equal()

static int domainset_equal ( const struct domainset *  one,
const struct domainset *  two 
)
static

Definition at line 449 of file kern_cpuset.c.

Referenced by _domainset_create(), and cpuset_testupdate_domain().

Here is the caller graph for this function:

◆ domainset_freelist_add()

static void domainset_freelist_add ( struct domainlist *  list,
int  count 
)
static

Definition at line 407 of file kern_cpuset.c.

References count, domainset_zone, and set.

Referenced by cpuset_modify_domain(), cpuset_setproc(), and domainset_freelist_init().

Here is the caller graph for this function:

◆ domainset_freelist_free()

static void domainset_freelist_free ( struct domainlist *  list)
static

Definition at line 427 of file kern_cpuset.c.

References domainset_zone, and set.

Referenced by _cpuset_setthread(), cpuset_modify_domain(), and cpuset_setproc().

Here is the caller graph for this function:

◆ domainset_freelist_init()

static void domainset_freelist_init ( struct domainlist *  list,
int  count 
)
static

Definition at line 419 of file kern_cpuset.c.

References count, and domainset_freelist_add().

Referenced by _cpuset_setthread(), cpuset_modify_domain(), and cpuset_setproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ domainset_init()

void domainset_init ( void  )

Definition at line 1529 of file kern_cpuset.c.

References _domainset_create(), domainset_firsttouch, domainset_fixed, domainset_interleave, domainset_prefer, and domainset_roundrobin.

Here is the call graph for this function:

◆ domainset_notify()

static void domainset_notify ( void  )
static

Definition at line 584 of file kern_cpuset.c.

References allproc_lock, and cpuset_kernel.

Referenced by cpuset_modify_domain().

Here is the caller graph for this function:

◆ domainset_restrict()

static int domainset_restrict ( const struct domainset *  parent,
const struct domainset *  child 
)
static

Definition at line 467 of file kern_cpuset.c.

References child, and parent.

Referenced by cpuset_testupdate_domain().

Here is the caller graph for this function:

◆ domainset_shadow()

static struct domainset * domainset_shadow ( const struct domainset *  pdomain,
const struct domainset *  domain,
struct domainlist *  freelist 
)
static

Definition at line 611 of file kern_cpuset.c.

References _domainset_create(), domain, and domainset_copy().

Referenced by cpuset_setproc_newbase(), cpuset_shadow(), and cpuset_update_domain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ domainset_valid()

static int domainset_valid ( const struct domainset *  parent,
const struct domainset *  child 
)
static

Definition at line 459 of file kern_cpuset.c.

References child, and parent.

Referenced by cpuset_init(), cpuset_modify_domain(), and cpuset_testshadow().

Here is the caller graph for this function:

◆ domainset_zero()

void domainset_zero ( void  )

Definition at line 1571 of file kern_cpuset.c.

References cpuset_domains, cpuset_lock, domainset0, domainset2, domainset_empty_vm(), domainset_firsttouch, and domainset_interleave.

Here is the call graph for this function:

◆ kern_cpuset_getaffinity()

int kern_cpuset_getaffinity ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id,
size_t  cpusetsize,
cpuset_t *  maskp 
)

Definition at line 1888 of file kern_cpuset.c.

References cpuset_check_capabilities(), cpuset_domain, cpuset_ref(), cpuset_refbase(), cpuset_refroot(), cpuset_rel(), cpuset_which(), free(), intr_getaffinity(), level, malloc(), mask, and set.

Referenced by sys_cpuset_getaffinity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_cpuset_getdomain()

int kern_cpuset_getdomain ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id,
size_t  domainsetsize,
domainset_t *  maskp,
int *  policyp 
)

Definition at line 2125 of file kern_cpuset.c.

References cpuset_check_capabilities(), cpuset_ref(), cpuset_refbase(), cpuset_refroot(), cpuset_rel(), cpuset_which(), domainset_copy(), free(), level, malloc(), mask, and set.

Referenced by sys_cpuset_getdomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_cpuset_getid()

int kern_cpuset_getid ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id,
cpusetid_t *  setid 
)

Definition at line 1821 of file kern_cpuset.c.

References cpuset_refbase(), cpuset_refroot(), cpuset_rel(), cpuset_which(), level, and set.

Referenced by sys_cpuset_getid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_cpuset_setaffinity()

int kern_cpuset_setaffinity ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id,
size_t  cpusetsize,
const cpuset_t *  maskp 
)

Definition at line 2000 of file kern_cpuset.c.

References cpuset_check_capabilities(), cpuset_modify(), cpuset_ref(), cpuset_refbase(), cpuset_refroot(), cpuset_rel(), cpuset_setproc(), cpuset_setthread(), cpuset_which(), free(), intr_setaffinity(), level, malloc(), mask, and set.

Referenced by sys_cpuset_setaffinity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_cpuset_setdomain()

int kern_cpuset_setdomain ( struct thread *  td,
cpulevel_t  level,
cpuwhich_t  which,
id_t  id,
size_t  domainsetsize,
const domainset_t *  maskp,
int  policy 
)

Definition at line 2252 of file kern_cpuset.c.

References _cpuset_setthread(), cpuset_check_capabilities(), cpuset_modify_domain(), cpuset_ref(), cpuset_refbase(), cpuset_refroot(), cpuset_rel(), cpuset_setproc(), cpuset_which(), domain, domainset2, domainset_copy(), domainset_empty_vm(), free(), level, malloc(), mask, and set.

Referenced by sys_cpuset_setdomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_cpuset_setid()

int kern_cpuset_setid ( struct thread *  td,
cpuwhich_t  which,
id_t  id,
cpusetid_t  setid 
)

Definition at line 1785 of file kern_cpuset.c.

References cpuset_lookup(), cpuset_rel(), cpuset_setproc(), and set.

Referenced by sys_cpuset_setid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LIST_HEAD()

LIST_HEAD ( domainlist  ,
domainset   
)

◆ sys_cpuset()

int sys_cpuset ( struct thread *  td,
struct cpuset_args uap 
)

Definition at line 1749 of file kern_cpuset.c.

References cpuset_create(), cpuset_refroot(), cpuset_rel(), cpuset_setproc(), set, and cpuset_args::setid.

Here is the call graph for this function:

◆ sys_cpuset_getaffinity()

int sys_cpuset_getaffinity ( struct thread *  td,
struct cpuset_getaffinity_args uap 
)

◆ sys_cpuset_getdomain()

int sys_cpuset_getdomain ( struct thread *  td,
struct cpuset_getdomain_args uap 
)

◆ sys_cpuset_getid()

int sys_cpuset_getid ( struct thread *  td,
struct cpuset_getid_args uap 
)

Definition at line 1813 of file kern_cpuset.c.

References cpuset_getid_args::id, kern_cpuset_getid(), cpuset_getid_args::level, cpuset_getid_args::setid, and cpuset_getid_args::which.

Here is the call graph for this function:

◆ sys_cpuset_setaffinity()

int sys_cpuset_setaffinity ( struct thread *  td,
struct cpuset_setaffinity_args uap 
)

◆ sys_cpuset_setdomain()

int sys_cpuset_setdomain ( struct thread *  td,
struct cpuset_setdomain_args uap 
)

◆ sys_cpuset_setid()

int sys_cpuset_setid ( struct thread *  td,
struct cpuset_setid_args uap 
)

Definition at line 1778 of file kern_cpuset.c.

References cpuset_setid_args::id, kern_cpuset_setid(), cpuset_setid_args::setid, and cpuset_setid_args::which.

Here is the call graph for this function:

◆ sysctl_handle_domainset()

int sysctl_handle_domainset ( SYSCTL_HANDLER_ARGS  )

Definition at line 1420 of file kern_cpuset.c.

References bitset_strprint(), bitset_strscan(), buf, domainset_create(), sprintf(), sscanf(), and sysctl_handle_string().

Here is the call graph for this function:

◆ SYSCTL_INT()

SYSCTL_INT ( _kern_sched  ,
OID_AUTO  ,
cpusetsize  ,
CTLFLAG_RD|  CTLFLAG_CAPRD,
SYSCTL_NULL_INT_PTR  ,
sizeof(cpuset_t)  ,
"sizeof(cpuset_t)"   
)

Variable Documentation

◆ cpuset_default

struct cpuset * cpuset_default
static

Definition at line 134 of file kern_cpuset.c.

Referenced by cpuset_thread0().

◆ cpuset_domain

cpuset_t cpuset_domain[MAXMEMDOM]

◆ cpuset_domains

struct domainlist cpuset_domains
static

Definition at line 132 of file kern_cpuset.c.

Referenced by _domainset_create(), and domainset_zero().

◆ cpuset_ids

struct setlist cpuset_ids
static

Definition at line 131 of file kern_cpuset.c.

Referenced by cpuset_init(), cpuset_lookup(), and cpuset_thread0().

◆ cpuset_kernel

struct cpuset * cpuset_kernel
static

Definition at line 134 of file kern_cpuset.c.

Referenced by cpuset_kernthread(), cpuset_thread0(), and domainset_notify().

◆ cpuset_lock

◆ cpuset_root

cpuset_t* cpuset_root

◆ cpuset_unr

struct unrhdr* cpuset_unr
static

Definition at line 133 of file kern_cpuset.c.

Referenced by cpuset_create(), cpuset_rel(), cpuset_rel_complete(), and cpuset_thread0().

◆ cpuset_zero

struct cpuset* cpuset_zero
static

Definition at line 134 of file kern_cpuset.c.

Referenced by cpuset_thread0().

◆ cpuset_zone

uma_zone_t cpuset_zone
static

◆ domainset0

struct domainset* domainset0
static

Definition at line 135 of file kern_cpuset.c.

Referenced by cpuset_thread0(), domainset_create(), and domainset_zero().

◆ domainset2

struct domainset * domainset2
static

Definition at line 135 of file kern_cpuset.c.

Referenced by cpuset_thread0(), domainset_zero(), and kern_cpuset_setdomain().

◆ domainset_firsttouch

struct domainset __read_mostly domainset_firsttouch

Definition at line 122 of file kern_cpuset.c.

Referenced by domainset_init(), and domainset_zero().

◆ domainset_fixed

struct domainset __read_mostly domainset_fixed[MAXMEMDOM]

Definition at line 123 of file kern_cpuset.c.

Referenced by domainset_init().

◆ domainset_interleave

struct domainset __read_mostly domainset_interleave

Definition at line 124 of file kern_cpuset.c.

Referenced by domainset_init(), and domainset_zero().

◆ domainset_prefer

struct domainset __read_mostly domainset_prefer[MAXMEMDOM]

Definition at line 125 of file kern_cpuset.c.

Referenced by domainset_init().

◆ domainset_roundrobin

struct domainset __read_mostly domainset_roundrobin

Definition at line 126 of file kern_cpuset.c.

Referenced by domainset_init().

◆ domainset_zone

uma_zone_t domainset_zone
static