Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F138038879
D17416.id48740.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D17416.id48740.diff
View Options
Index: sys/kern/kern_cpuset.c
===================================================================
--- sys/kern/kern_cpuset.c
+++ sys/kern/kern_cpuset.c
@@ -119,6 +119,7 @@
*/
LIST_HEAD(domainlist, domainset);
+struct domainset domainset_prefer[MAXMEMDOM], domainset_roundrobin;
static uma_zone_t cpuset_zone;
static uma_zone_t domainset_zone;
@@ -1368,6 +1369,32 @@
return _cpuset_setthread(id, &mask, NULL);
}
+/*
+ * Initialize static domainsets after NUMA information is available. This is
+ * called very early during boot.
+ */
+void
+domainset_init(void)
+{
+ struct domainset *dset;
+ int i;
+
+ /* Initialize the round-robin domain. */
+ dset = &domainset_roundrobin;
+ DOMAINSET_COPY(&all_domains, &dset->ds_mask);
+ dset->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
+ dset->ds_prefer = -1;
+ _domainset_create(dset, NULL);
+
+ for (i = 0; i < vm_ndomains; i++) {
+ dset = &domainset_prefer[i];
+ DOMAINSET_COPY(&all_domains, &dset->ds_mask);
+ dset->ds_policy = DOMAINSET_POLICY_PREFER;
+ dset->ds_prefer = i;
+ _domainset_create(dset, NULL);
+ }
+}
+
/*
* Create the domainset for cpuset 0, 1 and cpuset 2.
*/
@@ -1375,22 +1402,22 @@
domainset_zero(void)
{
struct domainset *dset;
- int i;
mtx_init(&cpuset_lock, "cpuset", NULL, MTX_SPIN | MTX_RECURSE);
dset = &domainset0;
- DOMAINSET_ZERO(&dset->ds_mask);
- for (i = 0; i < vm_ndomains; i++)
- DOMAINSET_SET(i, &dset->ds_mask);
+ DOMAINSET_COPY(&all_domains, &dset->ds_mask);
dset->ds_policy = DOMAINSET_POLICY_FIRSTTOUCH;
dset->ds_prefer = -1;
- (void)domainset_empty_vm(dset);
curthread->td_domain.dr_policy = _domainset_create(dset, NULL);
domainset_copy(dset, &domainset2);
domainset2.ds_policy = DOMAINSET_POLICY_INTERLEAVE;
kernel_object->domain.dr_policy = _domainset_create(&domainset2, NULL);
+
+ /* Remove empty domains from the global policies. */
+ LIST_FOREACH(dset, &cpuset_domains, ds_link)
+ (void)domainset_empty_vm(dset);
}
/*
Index: sys/sys/domainset.h
===================================================================
--- sys/sys/domainset.h
+++ sys/sys/domainset.h
@@ -32,8 +32,8 @@
#define _SYS_DOMAINSET_H_
#include <sys/_domainset.h>
-
#include <sys/bitset.h>
+#include <sys/queue.h>
#define _NDOMAINSETBITS _BITSET_BITS
#define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE)
@@ -96,6 +96,12 @@
domainid_t ds_order[MAXMEMDOM]; /* nth domain table. */
};
+extern struct domainset domainset_roundrobin;
+#define DOMAINSET_ROUNDROBIN() (&domainset_roundrobin)
+extern struct domainset domainset_prefer[MAXMEMDOM];
+#define DOMAINSET_PREFER(domain) (&domainset_prefer[(domain)])
+
+void domainset_init(void);
void domainset_zero(void);
/*
Index: sys/vm/vm_phys.h
===================================================================
--- sys/vm/vm_phys.h
+++ sys/vm/vm_phys.h
@@ -88,6 +88,8 @@
void vm_phys_free_pages(vm_page_t m, int order);
void vm_phys_init(void);
vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);
+void vm_phys_register_domains(int ndomains, struct mem_affinity *affinity,
+ int *locality);
vm_page_t vm_phys_scan_contig(int domain, u_long npages, vm_paddr_t low,
vm_paddr_t high, u_long alignment, vm_paddr_t boundary, int options);
void vm_phys_set_pool(int pool, vm_page_t m, int order);
Index: sys/vm/vm_phys.c
===================================================================
--- sys/vm/vm_phys.c
+++ sys/vm/vm_phys.c
@@ -46,6 +46,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/domainset.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -586,6 +587,33 @@
rw_init(&vm_phys_fictitious_reg_lock, "vmfctr");
}
+/*
+ * Register info about the NUMA topology of the system.
+ *
+ * Invoked by platform-dependent code prior to vm_phys_init().
+ */
+void
+vm_phys_register_domains(int ndomains, struct mem_affinity *affinity,
+ int *locality)
+{
+#ifdef NUMA
+ int i;
+
+ vm_ndomains = ndomains;
+ mem_affinity = affinity;
+ mem_locality = locality;
+
+ for (i = 0; i < vm_ndomains; i++)
+ DOMAINSET_SET(i, &all_domains);
+
+ domainset_init();
+#else
+ (void)ndomains;
+ (void)affinity;
+ (void)locality;
+#endif
+}
+
/*
* Split a contiguous, power of two-sized set of physical pages.
*
Index: sys/x86/acpica/srat.c
===================================================================
--- sys/x86/acpica/srat.c
+++ sys/x86/acpica/srat.c
@@ -153,10 +153,6 @@
acpi_unmap_table(slit);
slit = NULL;
-#ifdef NUMA
- /* Tell the VM about it! */
- mem_locality = vm_locality_table;
-#endif
return (0);
}
@@ -481,13 +477,6 @@
return (-1);
}
-#ifdef NUMA
- vm_ndomains = ndomain;
- for (int i = 0; i < vm_ndomains; i++)
- DOMAINSET_SET(i, &all_domains);
- mem_affinity = mem_info;
-#endif
-
return (0);
}
@@ -511,7 +500,8 @@
if (parse_srat() < 0)
return;
init_mem_locality();
- (void) parse_slit();
+ (void)parse_slit();
+ vm_phys_register_domains(ndomain, mem_info, vm_locality_table);
}
SYSINIT(parse_acpi_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_acpi_tables,
NULL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 29, 10:19 AM (2 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26327194
Default Alt Text
D17416.id48740.diff (4 KB)
Attached To
Mode
D17416: Initialize global domainsets during boot.
Attached
Detach File
Event Timeline
Log In to Comment