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

Function domainset_empty_vm

freebsd/kern/kern_cpuset.c:522–550  ·  view source on GitHub ↗

* Are any of the domains in the mask empty? If so, silently * remove them and update the domainset accordingly. If only empty * domains are present, we must return failure. */

Source from the content-addressed store, hash-verified

520 * domains are present, we must return failure.
521 */
522static bool
523domainset_empty_vm(struct domainset *domain)
524{
525 domainset_t empty;
526 int i, j;
527
528 DOMAINSET_ZERO(&empty);
529 for (i = 0; i < vm_ndomains; i++)
530 if (VM_DOMAIN_EMPTY(i))
531 DOMAINSET_SET(i, &empty);
532 if (DOMAINSET_SUBSET(&empty, &domain->ds_mask))
533 return (true);
534
535 /* Remove empty domains from the set and recompute. */
536 DOMAINSET_ANDNOT(&domain->ds_mask, &empty);
537 domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask);
538 for (i = j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++)
539 if (DOMAINSET_ISSET(i, &domain->ds_mask))
540 domain->ds_order[j++] = i;
541
542 /* Convert a PREFER policy referencing an empty domain to RR. */
543 if (domain->ds_policy == DOMAINSET_POLICY_PREFER &&
544 DOMAINSET_ISSET(domain->ds_prefer, &empty)) {
545 domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
546 domain->ds_prefer = -1;
547 }
548
549 return (false);
550}
551
552/*
553 * Create or lookup a domainset based on the key held in 'domain'.

Callers 2

domainset_zeroFunction · 0.85
kern_cpuset_setdomainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected