From nobody Wed Oct 20 01:23:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1DC4180FDA0; Wed, 20 Oct 2021 01:23:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYtCx0kMYz3llr; Wed, 20 Oct 2021 01:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23D5E1EB8A; Wed, 20 Oct 2021 01:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K1NOQf095644; Wed, 20 Oct 2021 01:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NOo7095643; Wed, 20 Oct 2021 01:23:24 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:24 GMT Message-Id: <202110200123.19K1NOo7095643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b801c79dda53 - main - vm_fault: Stop specifying VM_ALLOC_ZERO List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b801c79dda53294b55fa19b81d43be25e00ec81f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b801c79dda53294b55fa19b81d43be25e00ec81f commit b801c79dda53294b55fa19b81d43be25e00ec81f Author: Mark Johnston AuthorDate: 2021-10-20 00:27:23 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 vm_fault: Stop specifying VM_ALLOC_ZERO Now vm_page_alloc() and friends will unconditionally preserve PG_ZERO, so there is no point in setting this flag. Eliminate a local variable and add a comment explaining why we prioritize the allocation when the process is doomed. No functional change intended. Reviewed by: kib, alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32036 --- sys/vm/vm_fault.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 8a4b5a543dd6..6bc59222b50e 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1113,7 +1113,6 @@ static int vm_fault_allocate(struct faultstate *fs) { struct domainset *dset; - int alloc_req; int rv; if ((fs->object->flags & OBJ_SIZEVNLOCK) != 0) { @@ -1150,9 +1149,14 @@ vm_fault_allocate(struct faultstate *fs) /* * Allocate a new page for this object/offset pair. * - * Unlocked read of the p_flag is harmless. At worst, the P_KILLED - * might be not observed there, and allocation can fail, causing - * restart and new reading of the p_flag. + * If the process has a fatal signal pending, prioritize the allocation + * with the expectation that the process will exit shortly and free some + * pages. In particular, the signal may have been posted by the page + * daemon in an attempt to resolve an out-of-memory condition. + * + * The unlocked read of the p_flag is harmless. At worst, the P_KILLED + * might be not observed here, and allocation fails, causing a restart + * and new reading of the p_flag. */ dset = fs->object->domain.dr_policy; if (dset == NULL) @@ -1161,12 +1165,8 @@ vm_fault_allocate(struct faultstate *fs) #if VM_NRESERVLEVEL > 0 vm_object_color(fs->object, atop(fs->vaddr) - fs->pindex); #endif - alloc_req = P_KILLED(curproc) ? - VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL; - if (fs->object->type != OBJT_VNODE && - fs->object->backing_object == NULL) - alloc_req |= VM_ALLOC_ZERO; - fs->m = vm_page_alloc(fs->object, fs->pindex, alloc_req); + fs->m = vm_page_alloc(fs->object, fs->pindex, + P_KILLED(curproc) ? VM_ALLOC_SYSTEM : 0); } if (fs->m == NULL) { if (vm_fault_allocate_oom(fs))