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

Function cpuset_create

freebsd/kern/kern_cpuset.c:347–371  ·  view source on GitHub ↗

* Create a new non-anonymous set with the requested parent and mask. May * return failures if the mask is invalid or a new number can not be * allocated. * * If *setp is not NULL, then it will be used as-is. The caller must take * into account that *setp will be inserted at the head of cpuset_ids and * plan any potentially conflicting cs_link usage accordingly. */

Source from the content-addressed store, hash-verified

345 * plan any potentially conflicting cs_link usage accordingly.
346 */
347static int
348cpuset_create(struct cpuset **setp, struct cpuset *parent, const cpuset_t *mask)
349{
350 struct cpuset *set;
351 cpusetid_t id;
352 int error;
353 bool dofree;
354
355 id = alloc_unr(cpuset_unr);
356 if (id == -1)
357 return (ENFILE);
358 dofree = (*setp == NULL);
359 if (*setp != NULL)
360 set = *setp;
361 else
362 *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO);
363 error = cpuset_init(set, parent, mask, NULL, id);
364 if (error == 0)
365 return (0);
366 free_unr(cpuset_unr, id);
367 if (dofree)
368 uma_zfree(cpuset_zone, set);
369
370 return (error);
371}
372
373static void
374cpuset_freelist_add(struct setlist *list, int count)

Callers 4

cpuset_setproc_newbaseFunction · 0.85
cpuset_create_rootFunction · 0.85
sys_cpusetFunction · 0.85
setcpuaffinityFunction · 0.85

Calls 5

alloc_unrFunction · 0.85
cpuset_initFunction · 0.85
free_unrFunction · 0.85
uma_zallocFunction · 0.50
uma_zfreeFunction · 0.50

Tested by

no test coverage detected