aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2018-09-24 19:24:17 +0000
committerMark Johnston <markj@FreeBSD.org>2018-09-24 19:24:17 +0000
commit463406ac4a531b8f4c6102715c17da6183d10be3 (patch)
tree6ba8a52b11415edc92ffae0f76bb753ae51b9cb3 /sys/vm
parent7362ac9ca95598c2715ea3fe8f25231cf3ce104f (diff)
downloadsrc-463406ac4a531b8f4c6102715c17da6183d10be3.tar.gz
src-463406ac4a531b8f4c6102715c17da6183d10be3.zip
Add more NUMA-specific low memory predicates.
Use these predicates instead of inline references to vm_min_domains. Also add a global all_domains set, akin to all_cpus. Reviewed by: alc, jeff, kib Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17278
Notes
Notes: svn path=/head/; revision=338919
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_domainset.c16
-rw-r--r--sys/vm/vm_page.c4
-rw-r--r--sys/vm/vm_phys.c1
3 files changed, 11 insertions, 10 deletions
diff --git a/sys/vm/vm_domainset.c b/sys/vm/vm_domainset.c
index 16b078e7dabd..b9348d6c632b 100644
--- a/sys/vm/vm_domainset.c
+++ b/sys/vm/vm_domainset.c
@@ -66,6 +66,7 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, struct vm_object *obj,
vm_pindex_t pindex)
{
struct domainset *domain;
+ struct thread *td;
/*
* object policy takes precedence over thread policy. The policies
@@ -76,8 +77,9 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, struct vm_object *obj,
di->di_domain = domain;
di->di_iter = &obj->domain.dr_iterator;
} else {
- di->di_domain = curthread->td_domain.dr_policy;
- di->di_iter = &curthread->td_domain.dr_iterator;
+ td = curthread;
+ di->di_domain = td->td_domain.dr_policy;
+ di->di_iter = &td->td_domain.dr_iterator;
}
di->di_policy = di->di_domain->ds_policy;
if (di->di_policy == DOMAINSET_POLICY_INTERLEAVE) {
@@ -215,7 +217,7 @@ vm_domainset_iter_page_init(struct vm_domainset_iter *di, struct vm_object *obj,
*req = (di->di_flags & ~(VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) |
VM_ALLOC_NOWAIT;
vm_domainset_iter_first(di, domain);
- if (DOMAINSET_ISSET(*domain, &vm_min_domains))
+ if (vm_page_count_min_domain(*domain))
vm_domainset_iter_page(di, domain, req);
}
@@ -233,8 +235,7 @@ vm_domainset_iter_page(struct vm_domainset_iter *di, int *domain, int *req)
/* If there are more domains to visit we run the iterator. */
while (--di->di_n != 0) {
vm_domainset_iter_next(di, domain);
- if (!di->di_minskip ||
- !DOMAINSET_ISSET(*domain, &vm_min_domains))
+ if (!di->di_minskip || !vm_page_count_min_domain(*domain))
return (0);
}
if (di->di_minskip) {
@@ -269,7 +270,7 @@ vm_domainset_iter_malloc_init(struct vm_domainset_iter *di,
di->di_flags = *flags;
*flags = (di->di_flags & ~M_WAITOK) | M_NOWAIT;
vm_domainset_iter_first(di, domain);
- if (DOMAINSET_ISSET(*domain, &vm_min_domains))
+ if (vm_page_count_min_domain(*domain))
vm_domainset_iter_malloc(di, domain, flags);
}
@@ -280,8 +281,7 @@ vm_domainset_iter_malloc(struct vm_domainset_iter *di, int *domain, int *flags)
/* If there are more domains to visit we run the iterator. */
while (--di->di_n != 0) {
vm_domainset_iter_next(di, domain);
- if (!di->di_minskip ||
- !DOMAINSET_ISSET(*domain, &vm_min_domains))
+ if (!di->di_minskip || !vm_page_count_min_domain(*domain))
return (0);
}
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index d022435704f1..47628cba2ac1 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2959,7 +2959,7 @@ vm_wait_doms(const domainset_t *wdoms)
* consume all freed pages while old allocators wait.
*/
mtx_lock(&vm_domainset_lock);
- if (DOMAINSET_SUBSET(&vm_min_domains, wdoms)) {
+ if (vm_page_count_min_set(wdoms)) {
vm_min_waiters++;
msleep(&vm_min_domains, &vm_domainset_lock,
PVM | PDROP, "vmwait", 0);
@@ -3078,7 +3078,7 @@ vm_waitpfault(struct domainset *dset)
* consume all freed pages while old allocators wait.
*/
mtx_lock(&vm_domainset_lock);
- if (DOMAINSET_SUBSET(&vm_min_domains, &dset->ds_mask)) {
+ if (vm_page_count_min_set(&dset->ds_mask)) {
vm_min_waiters++;
msleep(&vm_min_domains, &vm_domainset_lock, PUSER | PDROP,
"pfault", 0);
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 890f5dad9213..5206ba6e658f 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -78,6 +78,7 @@ int __read_mostly *mem_locality;
#endif
int __read_mostly vm_ndomains = 1;
+domainset_t __read_mostly all_domains = DOMAINSET_T_INITIALIZER(0x1);
struct vm_phys_seg __read_mostly vm_phys_segs[VM_PHYSSEG_MAX];
int __read_mostly vm_phys_nsegs;