Page MenuHomeFreeBSD

D38112.diff
No OneTemporary

D38112.diff

diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
--- a/lib/libthr/thread/thr_attr.c
+++ b/lib/libthr/thread/thr_attr.c
@@ -599,8 +599,10 @@
size_t len;
len = sizeof(kern_cpuset_size);
- if (sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size,
- &len, NULL, 0))
+ if (sysctlbyname("kern.sched.cpusetsizemin", &kern_cpuset_size,
+ &len, NULL, 0) != 0 &&
+ sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size,
+ &len, NULL, 0) != 0)
PANIC("failed to get sysctl kern.sched.cpusetsize");
}
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
@@ -136,11 +136,17 @@
static struct unrhdr *cpuset_unr;
static struct cpuset *cpuset_zero, *cpuset_default, *cpuset_kernel;
static struct domainset *domainset0, *domainset2;
+u_int cpusetsizemin = 1;
/* Return the size of cpuset_t at the kernel level */
SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD | CTLFLAG_CAPRD,
SYSCTL_NULL_INT_PTR, sizeof(cpuset_t), "sizeof(cpuset_t)");
+/* Return the minimum size of cpuset_t allowed by the kernel */
+SYSCTL_UINT(_kern_sched, OID_AUTO, cpusetsizemin,
+ CTLFLAG_RD | CTLFLAG_CAPRD, &cpusetsizemin, 0,
+ "The minimum size of cpuset_t allowed by the kernel");
+
cpuset_t *cpuset_root;
cpuset_t cpuset_domain[MAXMEMDOM];
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -148,6 +148,8 @@
KASSERT(mp_maxid >= mp_ncpus - 1,
("%s: counters out of sync: max %d, count %d", __func__,
mp_maxid, mp_ncpus));
+
+ cpusetsizemin = howmany(mp_maxid + 1, NBBY);
}
SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL);
diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h
--- a/sys/sys/cpuset.h
+++ b/sys/sys/cpuset.h
@@ -120,6 +120,7 @@
#include <sys/queue.h>
LIST_HEAD(setlist, cpuset);
+extern u_int cpusetsizemin;
/*
* cpusets encapsulate cpu binding information for one or more threads.

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 25, 7:27 PM (8 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24186061
Default Alt Text
D38112.diff (1 KB)

Event Timeline