diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2019-08-06 21:50:34 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2019-08-06 21:50:34 +0000 |
commit | c16850865572058518fa625359057032563c8baf (patch) | |
tree | 8270122d8630fa2c46d44c6c4a8a95fab4821103 /sys/vm/vm_phys.c | |
parent | cb71f1fa0183c8f8c8e339452e3ecd1e1717d621 (diff) | |
download | src-c16850865572058518fa625359057032563c8baf.tar.gz src-c16850865572058518fa625359057032563c8baf.zip |
Add two new kernel options to control memory locality on NUMA hardware.
- UMA_XDOMAIN enables an additional per-cpu bucket for freed memory that
was freed on a different domain from where it was allocated. This is
only used for UMA_ZONE_NUMA (first-touch) zones.
- UMA_FIRSTTOUCH sets the default UMA policy to be first-touch for all
zones. This tries to maintain locality for kernel memory.
Reviewed by: gallatin, alc, kib
Tested by: pho, gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20929
Notes
Notes:
svn path=/head/; revision=350659
Diffstat (limited to 'sys/vm/vm_phys.c')
-rw-r--r-- | sys/vm/vm_phys.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 48e7f6c9a795..c16282974a40 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -623,6 +623,26 @@ vm_phys_register_domains(int ndomains, struct mem_affinity *affinity, #endif } +int +_vm_phys_domain(vm_paddr_t pa) +{ +#ifdef NUMA + int i; + + if (vm_ndomains == 1 || mem_affinity == NULL) + return (0); + + /* + * Check for any memory that overlaps. + */ + for (i = 0; mem_affinity[i].end != 0; i++) + if (mem_affinity[i].start <= pa && + mem_affinity[i].end >= pa) + return (mem_affinity[i].domain); +#endif + return (0); +} + /* * Split a contiguous, power of two-sized set of physical pages. * |