Date: Sun, 10 Jan 2016 17:53:43 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293640 - head/sys/vm Message-ID: <201601101753.u0AHrhSJ099996@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Sun Jan 10 17:53:43 2016 New Revision: 293640 URL: https://svnweb.freebsd.org/changeset/base/293640 Log: Fix the domain iterator to not try the first-touch / fixed domain more than once when doing round-robin. This lead to a panic because the iterator was trying the same domain twice and not trying one of the other domains. Reported by: pho Tested by: pho Modified: head/sys/vm/vm_domain.c Modified: head/sys/vm/vm_domain.c ============================================================================== --- head/sys/vm/vm_domain.c Sun Jan 10 17:47:57 2016 (r293639) +++ head/sys/vm/vm_domain.c Sun Jan 10 17:53:43 2016 (r293640) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_domain.h> static __inline int -vm_domain_rr_selectdomain(void) +vm_domain_rr_selectdomain(int skip_domain) { #if MAXMEMDOM > 1 struct thread *td; @@ -71,6 +71,16 @@ vm_domain_rr_selectdomain(void) td->td_dom_rr_idx++; td->td_dom_rr_idx %= vm_ndomains; + + /* + * If skip_domain is provided then skip over that + * domain. This is intended for round robin variants + * which first try a fixed domain. + */ + if ((skip_domain > -1) && (td->td_dom_rr_idx == skip_domain)) { + td->td_dom_rr_idx++; + td->td_dom_rr_idx %= vm_ndomains; + } return (td->td_dom_rr_idx); #else return (0); @@ -339,12 +349,12 @@ vm_domain_iterator_run(struct vm_domain_ if (vi->n == vm_ndomains) *domain = vi->domain; else - *domain = vm_domain_rr_selectdomain(); + *domain = vm_domain_rr_selectdomain(vi->domain); vi->n--; break; case VM_POLICY_ROUND_ROBIN: default: - *domain = vm_domain_rr_selectdomain(); + *domain = vm_domain_rr_selectdomain(-1); vi->n--; break; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601101753.u0AHrhSJ099996>