Page MenuHomeFreeBSD

D54098.diff
No OneTemporary

D54098.diff

diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -1725,38 +1725,57 @@
}
/*
- * Create a cpuset, which would be cpuset_create() but
- * mark the new 'set' as root.
+ * create a cpuset derived from the requested cpuset. this is effectively the
+ * same as cpuset_create(), but we mark the new 'set' as root.
*
- * We are not going to reparent the td to it. Use cpuset_setproc_update_set()
+ * we are not going to reparent the td to it. use cpuset_setproc_update_set()
* for that.
*
- * In case of no error, returns the set in *setp locked with a reference.
+ * in case of no error, returns the set in *setp locked with a reference.
*/
int
-cpuset_create_root(struct prison *pr, struct cpuset **setp)
+cpuset_create_root_from(struct cpuset *set, struct cpuset **setp)
{
- struct cpuset *set;
+ struct cpuset *newroot;
int error;
- KASSERT(pr != NULL, ("[%s:%d] invalid pr", __func__, __LINE__));
+ KASSERT(set != NULL, ("[%s:%d] invalid parent set", __func__,
+ __LINE__));
KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__));
- set = NULL;
- error = cpuset_create(&set, pr->pr_cpuset, &pr->pr_cpuset->cs_mask);
+ newroot = NULL;
+ error = cpuset_create(&newroot, set, &set->cs_mask);
if (error)
return (error);
- KASSERT(set != NULL, ("[%s:%d] cpuset_create returned invalid data",
+ KASSERT(newroot != NULL, ("[%s:%d] cpuset_create returned invalid data",
__func__, __LINE__));
/* Mark the set as root. */
- set->cs_flags |= CPU_SET_ROOT;
- *setp = set;
+ newroot->cs_flags |= CPU_SET_ROOT;
+ *setp = newroot;
return (0);
}
+/*
+ * create a cpuset derived from the referenced prison's set. this is
+ * effectively the same as cpuset_create(), but we mark the new 'set' as root.
+ *
+ * we are not going to reparent the td to it. use cpuset_setproc_update_set()
+ * for that.
+ *
+ * in case of no error, returns the set in *setp locked with a reference.
+ */
+int
+cpuset_create_root(struct prison *pr, struct cpuset **setp)
+{
+ KASSERT(pr != NULL, ("[%s:%d] invalid pr", __func__, __LINE__));
+ KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__));
+
+ return (cpuset_create_root_from(pr->pr_cpuset, setp));
+}
+
int
cpuset_setproc_update_set(struct proc *p, struct cpuset *set)
{
diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h
--- a/sys/sys/cpuset.h
+++ b/sys/sys/cpuset.h
@@ -169,6 +169,7 @@
void cpuset_rel(struct cpuset *);
int cpuset_setthread(lwpid_t id, cpuset_t *);
int cpuset_setithread(lwpid_t id, int cpu);
+int cpuset_create_root_from(struct cpuset *, struct cpuset **);
int cpuset_create_root(struct prison *, struct cpuset **);
int cpuset_setproc_update_set(struct proc *, struct cpuset *);
int cpuset_which(cpuwhich_t, id_t, struct proc **,

File Metadata

Mime Type
text/plain
Expires
Wed, Jun 24, 1:10 PM (9 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34264900
Default Alt Text
D54098.diff (2 KB)

Event Timeline