Date: Mon, 26 Aug 2019 20:20:10 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351518 - head/sys/vm Message-ID: <201908262020.x7QKKAtS021698@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Aug 26 20:20:10 2019 New Revision: 351518 URL: https://svnweb.freebsd.org/changeset/base/351518 Log: Fix a few nits in vm_pqbatch_process_page(). - Don't bother masking off non-queue state flags when loading the page's atomic state, since it is only required for one of the function's assertions. Update the assertion instead. - Remove an incorrect comment regarding synchronization with the page daemon. The page daemon only ever checks for PGA_ENQUEUED with the page queue lock held. - When clearing requeue flags, only clear the flags that have been acted upon. Reviewed by: kib (previous version) Discussed with: alc Tested by: pho (part of a larger patch) MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21368 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Aug 26 18:57:29 2019 (r351517) +++ head/sys/vm/vm_page.c Mon Aug 26 20:20:10 2019 (r351518) @@ -3081,9 +3081,10 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa * the page queue lock held. In this case it is about to free the page, * which must not have any queue state. */ - qflags = atomic_load_8(&m->aflags) & PGA_QUEUE_STATE_MASK; - KASSERT(pq == vm_page_pagequeue(m) || qflags == 0, - ("page %p doesn't belong to queue %p but has queue state %#x", + qflags = atomic_load_8(&m->aflags); + KASSERT(pq == vm_page_pagequeue(m) || + (qflags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p doesn't belong to queue %p but has aflags %#x", m, pq, qflags)); if ((qflags & PGA_DEQUEUE) != 0) { @@ -3097,6 +3098,13 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa vm_pagequeue_cnt_inc(pq); vm_page_aflag_set(m, PGA_ENQUEUED); } + + /* + * Give PGA_REQUEUE_HEAD precedence over PGA_REQUEUE. + * In particular, if both flags are set in close succession, + * only PGA_REQUEUE_HEAD will be applied, even if it was set + * first. + */ if ((qflags & PGA_REQUEUE_HEAD) != 0) { KASSERT(m->queue == PQ_INACTIVE, ("head enqueue not supported for page %p", m)); @@ -3105,12 +3113,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa } else TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); - /* - * PGA_REQUEUE and PGA_REQUEUE_HEAD must be cleared after - * setting PGA_ENQUEUED in order to synchronize with the - * page daemon. - */ - vm_page_aflag_clear(m, PGA_REQUEUE | PGA_REQUEUE_HEAD); + vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | + PGA_REQUEUE_HEAD)); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908262020.x7QKKAtS021698>