Date: Tue, 18 Oct 2016 10:12:56 +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-11@freebsd.org Subject: svn commit: r307552 - stable/11/sys/vm Message-ID: <201610181012.u9IACu9b025077@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Oct 18 10:12:55 2016 New Revision: 307552 URL: https://svnweb.freebsd.org/changeset/base/307552 Log: MFC r307064: When downgrading exclusively busied page to shared-busy state, wakeup waiters. Modified: stable/11/sys/vm/vm_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Tue Oct 18 07:16:49 2016 (r307551) +++ stable/11/sys/vm/vm_page.c Tue Oct 18 10:12:55 2016 (r307552) @@ -657,15 +657,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?201610181012.u9IACu9b025077>