MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cpuset_setproc_setthread_mask

Function cpuset_setproc_setthread_mask

freebsd/kern/kern_cpuset.c:1071–1103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069}
1070
1071static int
1072cpuset_setproc_setthread_mask(struct cpuset *tdset, struct cpuset *set,
1073 cpuset_t *mask, struct domainset *domain)
1074{
1075 struct cpuset *parent;
1076
1077 parent = cpuset_getbase(tdset);
1078
1079 /*
1080 * If the thread restricted its mask then apply that same
1081 * restriction to the new set, otherwise take it wholesale.
1082 */
1083 if (CPU_CMP(&tdset->cs_mask, &parent->cs_mask) != 0) {
1084 CPU_COPY(&tdset->cs_mask, mask);
1085 CPU_AND(mask, &set->cs_mask);
1086 } else
1087 CPU_COPY(&set->cs_mask, mask);
1088
1089 /*
1090 * If the thread restricted the domain then we apply the
1091 * restriction to the new set but retain the policy.
1092 */
1093 if (tdset->cs_domain != parent->cs_domain) {
1094 domainset_copy(tdset->cs_domain, domain);
1095 DOMAINSET_AND(&domain->ds_mask, &set->cs_domain->ds_mask);
1096 } else
1097 domainset_copy(set->cs_domain, domain);
1098
1099 if (CPU_EMPTY(mask) || DOMAINSET_EMPTY(&domain->ds_mask))
1100 return (EDEADLK);
1101
1102 return (0);
1103}
1104
1105static int
1106cpuset_setproc_test_setthread(struct cpuset *tdset, struct cpuset *set)

Callers 2

cpuset_setproc_setthreadFunction · 0.85

Calls 2

cpuset_getbaseFunction · 0.85
domainset_copyFunction · 0.85

Tested by

no test coverage detected