Date: Tue, 18 Oct 2016 10:33:28 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307555 - stable/10/sys/vm Message-ID: <201610181033.u9IAXSxm032727@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Oct 18 10:33:28 2016 New Revision: 307555 URL: https://svnweb.freebsd.org/changeset/base/307555 Log: MFC r307064: When downgrading exclusively busied page to shared-busy state, wakeup waiters. Modified: stable/10/sys/vm/vm_page.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Tue Oct 18 10:20:58 2016 (r307554) +++ stable/10/sys/vm/vm_page.c Tue Oct 18 10:33:28 2016 (r307555) @@ -515,15 +515,26 @@ void vm_page_busy_downgrade(vm_page_t m) { u_int x; + bool locked; vm_page_assert_xbusied(m); + locked = mtx_owned(vm_page_lockptr(m)); for (;;) { x = m->busy_lock; x &= VPB_BIT_WAITERS; + if (x != 0 && !locked) + vm_page_lock(m); if (atomic_cmpset_rel_int(&m->busy_lock, - VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1) | x)) + VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1))) break; + if (x != 0 && !locked) + vm_page_unlock(m); + } + if (x != 0) { + wakeup(m); + if (!locked) + vm_page_unlock(m); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610181033.u9IAXSxm032727>