From owner-svn-src-stable-12@freebsd.org Mon Sep 2 21:52:19 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DB23E8B4F; Mon, 2 Sep 2019 21:52:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46MkMR11jDz4Ln7; Mon, 2 Sep 2019 21:52:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0725E20864; Mon, 2 Sep 2019 21:52:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x82LqIdI069667; Mon, 2 Sep 2019 21:52:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x82LqIHZ069666; Mon, 2 Sep 2019 21:52:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909022152.x82LqIHZ069666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Sep 2019 21:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351726 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 351726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Sep 2019 21:52:19 -0000 Author: markj Date: Mon Sep 2 21:52:18 2019 New Revision: 351726 URL: https://svnweb.freebsd.org/changeset/base/351726 Log: MFC r351518: Fix a few nits in vm_pqbatch_process_page(). Modified: stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Mon Sep 2 19:04:02 2019 (r351725) +++ stable/12/sys/vm/vm_page.c Mon Sep 2 21:52:18 2019 (r351726) @@ -3104,9 +3104,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) { @@ -3120,6 +3121,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)); @@ -3128,12 +3136,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)); } }