From owner-svn-src-stable@freebsd.org Thu Jul 11 15:38:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D925115D6C34; Thu, 11 Jul 2019 15:38:41 +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 7FECE8491B; Thu, 11 Jul 2019 15:38:41 +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 590608E6; Thu, 11 Jul 2019 15:38:41 +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 x6BFcfap093413; Thu, 11 Jul 2019 15:38:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BFceag093412; Thu, 11 Jul 2019 15:38:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907111538.x6BFceag093412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 15:38:40 +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: r349911 - 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: 349911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7FECE8491B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:38:42 -0000 Author: markj Date: Thu Jul 11 15:38:40 2019 New Revision: 349911 URL: https://svnweb.freebsd.org/changeset/base/349911 Log: MFC r349612: Mark pages allocated from the per-CPU cache. Modified: stable/12/sys/vm/vm_page.c stable/12/sys/vm/vm_page.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Thu Jul 11 15:36:59 2019 (r349910) +++ stable/12/sys/vm/vm_page.c Thu Jul 11 15:38:40 2019 (r349911) @@ -1808,8 +1808,9 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind if (object != NULL) VM_OBJECT_ASSERT_WLOCKED(object); -again: + flags = 0; m = NULL; +again: #if VM_NRESERVLEVEL > 0 /* * Can we allocate the page from a reservation? @@ -1825,8 +1826,10 @@ again: vmd = VM_DOMAIN(domain); if (object != NULL && vmd->vmd_pgcache != NULL) { m = uma_zalloc(vmd->vmd_pgcache, M_NOWAIT); - if (m != NULL) + if (m != NULL) { + flags |= PG_PCPU_CACHE; goto found; + } } if (vm_domain_allocate(vmd, req, 1)) { /* @@ -1854,10 +1857,8 @@ again: } /* - * At this point we had better have found a good page. + * At this point we had better have found a good page. */ - KASSERT(m != NULL, ("missing page")); - found: vm_page_dequeue(m); vm_page_alloc_check(m); @@ -1865,10 +1866,8 @@ found: /* * Initialize the page. Only the PG_ZERO flag is inherited. */ - flags = 0; if ((req & VM_ALLOC_ZERO) != 0) - flags = PG_ZERO; - flags &= m->flags; + flags |= (m->flags & PG_ZERO); if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; @@ -2014,6 +2013,7 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pin * Can we allocate the pages without the number of free pages falling * below the lower bound for the allocation class? */ + m_ret = NULL; again: #if VM_NRESERVLEVEL > 0 /* @@ -2029,7 +2029,6 @@ again: goto found; } #endif - m_ret = NULL; vmd = VM_DOMAIN(domain); if (vm_domain_allocate(vmd, req, npages)) { /* @@ -3475,7 +3474,7 @@ vm_page_free_toq(vm_page_t m) return; vmd = vm_pagequeue_domain(m); - if (m->pool == VM_FREEPOOL_DEFAULT && vmd->vmd_pgcache != NULL) { + if ((m->flags & PG_PCPU_CACHE) != 0 && vmd->vmd_pgcache != NULL) { uma_zfree(vmd->vmd_pgcache, m); return; } Modified: stable/12/sys/vm/vm_page.h ============================================================================== --- stable/12/sys/vm/vm_page.h Thu Jul 11 15:36:59 2019 (r349910) +++ stable/12/sys/vm/vm_page.h Thu Jul 11 15:38:40 2019 (r349911) @@ -377,6 +377,7 @@ extern struct mtx_padalign pa_lock[]; * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. */ +#define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */