Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_cpuset.c
Show First 20 Lines • Show All 1,379 Lines • ▼ Show 20 Lines | |||||
* dedicate them to high priority tasks or save power etc. | * dedicate them to high priority tasks or save power etc. | ||||
* 2 - The kernel set which allows restriction and policy to be applied only | * 2 - The kernel set which allows restriction and policy to be applied only | ||||
* to kernel threads and the kernel_object. | * to kernel threads and the kernel_object. | ||||
*/ | */ | ||||
struct cpuset * | struct cpuset * | ||||
cpuset_thread0(void) | cpuset_thread0(void) | ||||
{ | { | ||||
struct cpuset *set; | struct cpuset *set; | ||||
int error; | |||||
int i; | int i; | ||||
#ifdef INVARIANTS | |||||
int error; | |||||
#endif | |||||
cpuset_zone = uma_zcreate("cpuset", sizeof(struct cpuset), NULL, NULL, | cpuset_zone = uma_zcreate("cpuset", sizeof(struct cpuset), NULL, NULL, | ||||
NULL, NULL, UMA_ALIGN_CACHE, 0); | NULL, NULL, UMA_ALIGN_CACHE, 0); | ||||
domainset_zone = uma_zcreate("domainset", sizeof(struct domainset), | domainset_zone = uma_zcreate("domainset", sizeof(struct domainset), | ||||
NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); | NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); | ||||
/* | /* | ||||
* Create the root system set (0) for the whole machine. Doesn't use | * Create the root system set (0) for the whole machine. Doesn't use | ||||
* cpuset_create() due to NULL parent. | * cpuset_create() due to NULL parent. | ||||
*/ | */ | ||||
set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | ||||
CPU_COPY(&all_cpus, &set->cs_mask); | CPU_COPY(&all_cpus, &set->cs_mask); | ||||
LIST_INIT(&set->cs_children); | LIST_INIT(&set->cs_children); | ||||
LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); | LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); | ||||
set->cs_ref = 1; | set->cs_ref = 1; | ||||
set->cs_flags = CPU_SET_ROOT | CPU_SET_RDONLY; | set->cs_flags = CPU_SET_ROOT | CPU_SET_RDONLY; | ||||
set->cs_domain = &domainset0; | set->cs_domain = &domainset0; | ||||
cpuset_zero = set; | cpuset_zero = set; | ||||
cpuset_root = &set->cs_mask; | cpuset_root = &set->cs_mask; | ||||
/* | /* | ||||
* Now derive a default (1), modifiable set from that to give out. | * Now derive a default (1), modifiable set from that to give out. | ||||
*/ | */ | ||||
set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | ||||
error = _cpuset_create(set, cpuset_zero, NULL, NULL, 1); | DBGSET(error, _cpuset_create(set, cpuset_zero, NULL, NULL, 1)); | ||||
KASSERT(error == 0, ("Error creating default set: %d\n", error)); | KASSERT(error == 0, ("Error creating default set: %d\n", error)); | ||||
cpuset_default = set; | cpuset_default = set; | ||||
/* | /* | ||||
* Create the kernel set (2). | * Create the kernel set (2). | ||||
*/ | */ | ||||
set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); | ||||
error = _cpuset_create(set, cpuset_zero, NULL, NULL, 2); | DBGSET(error, _cpuset_create(set, cpuset_zero, NULL, NULL, 2)); | ||||
KASSERT(error == 0, ("Error creating kernel set: %d\n", error)); | KASSERT(error == 0, ("Error creating kernel set: %d\n", error)); | ||||
set->cs_domain = &domainset2; | set->cs_domain = &domainset2; | ||||
cpuset_kernel = set; | cpuset_kernel = set; | ||||
/* | /* | ||||
* Initialize the unit allocator. 0 and 1 are allocated above. | * Initialize the unit allocator. 0 and 1 are allocated above. | ||||
*/ | */ | ||||
cpuset_unr = new_unrhdr(2, INT_MAX, NULL); | cpuset_unr = new_unrhdr(2, INT_MAX, NULL); | ||||
▲ Show 20 Lines • Show All 788 Lines • Show Last 20 Lines |