Date: Fri, 9 Mar 2007 14:28:51 +0100 From: Divacky Roman <xdivac02@stud.fit.vutbr.cz> To: hackers@freebsd.org Cc: alc@freebsd.org Subject: possibly missed wakeup in swap_pager_getpages() Message-ID: <20070309132851.GA52655@stud.fit.vutbr.cz>
next in thread | raw e-mail | index | archive | help
hi when looking at PR103455 I found this and I have a question.. code: swp_pager_strategy(bp); /* * wait for the page we want to complete. VPO_SWAPINPROG is always * cleared on completion. If an I/O error occurs, SWAPBLK_NONE * is set in the meta-data. */ VM_OBJECT_LOCK(object); while ((mreq->oflags & VPO_SWAPINPROG) != 0) { mreq->oflags |= VPO_WANTED; vm_page_lock_queues(); vm_page_flag_set(mreq, PG_REFERENCED); vm_page_unlock_queues(); cnt.v_intrans++; if (msleep(mreq, VM_OBJECT_MTX(object), PSWP, "swread", hz*20)) { the swp_pager_strategy() initiates IO (which should issue the wakeup() necessary for the msleep()). the problem in the PR is that the msleep() is never (within the specified 20 seconds) woken up. I wonder if this is because the wakeup arrives BEFORE the actual msleep() is issued. the page queue locking can take some time so there is a space for a missed wakeup. is my analysis correct? if so, can the race be mitigated by moving the flag setting (hence also the locking) after the msleep()? thnx roman
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070309132851.GA52655>