From nobody Tue Jul 30 15:38:45 2024 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 4WYKBt076Bz5RRRQ; Tue, 30 Jul 2024 15:38:46 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYKBs6j30z42Hy; Tue, 30 Jul 2024 15:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722353925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tyQTmNtbBrV+viAxd6pi7z4fOD3wUrsbV1sXJsMTewc=; b=EczLmyK9V9qgJjm09LCJxxwtjvECAfenYtRjWbjoX60Zo+tg0ix4M5ZvpVm1HbaURzIf5o u/YP1qJeAOJAxJqYR4qB+M8s4DTOemwQcDvVtjeg8ytQg/LhTBmQ1SAAkVV1p6lPO0vtrF c5zT1q8nmro9pntZbixvroOav2dWmhxjJxNqSUmAXNSx/yjE8kJxIBU1U9EcJFFpi8lyhE 8vZdtLGuFPwhmeBKbYmv+ut5hslK23lm2SDclD1mbfR20/d5FinOBH+gYN83cmdlZdSOzm 3UkLMn6kM+QFSL4ZFXO7f7+oUMh7Wo8SWF3+e266r2+HGMTMmUylIYq7v3ywVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722353925; a=rsa-sha256; cv=none; b=M6qDIdzFUE4RM6RKyfb1CFt1ogYGhI1hhmbiRTWQQzkrEFfrAHXfdqEC23QE8n097DZDhs a7dSy27U4V4nKE8Fa2Nio/URCEYq9Qeio2fIeRv9g4h0WFQDcClbDlq0NZH8YXelExvM72 nzWXWtdB3CKSD5iBz0RZAKS6PAYGKTapf/GUOBsFDfQzd/SM90Bq/V5K5OjIN1R+Z8S54l RnXmM5BR/yYvnZOO9ZigkWzJ2GiXyohLWiWr/jgIvVf/pUS/IP4O930XGknROTHeYI8B/L f+AtSILxBsi27rkWSBs2kqPCqK21D5ncyRqUyb4I2GWH4yhqG1RcZCFQ6djrdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722353925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tyQTmNtbBrV+viAxd6pi7z4fOD3wUrsbV1sXJsMTewc=; b=Vi741MaxvuAhVIwE0YOJVlWiqMKJaS0U8l36nao8D8EH3TwJ7WCelkM5zRSjpL50qiP6vg NHl2aTF9q8cCSRH0BQdqh3rFOgd8J6nF3o1i17tETG9i+OCATTE2SzYxxAUUaVH682weUa /fx1zedJpy3SMVwJI1hFSqcD5UWB6Pty0JPX8stpwP2K+ian6eH2ovsUu7+VHpjQlTNLVF bOGSavPhb6dZXpRmYS6nO1aalejTulsQ1tMO2YZpadfCNrgutPWh4BLUXs4S6REPfCEBbL 7E/toXVJAjjH1ISG7SnlzNjs3x8PAYzyaJC51CEIIkSgBwp144ByZqIRPHUH7A== 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 4WYKBs6Jm8zNWR; Tue, 30 Jul 2024 15:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46UFcjfF049552; Tue, 30 Jul 2024 15:38:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UFcjNx049549; Tue, 30 Jul 2024 15:38:45 GMT (envelope-from git) Date: Tue, 30 Jul 2024 15:38:45 GMT Message-Id: <202407301538.46UFcjNx049549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 92b9138991dd - main - vm: Introduce VM_ALLOC_NOFREE and PG_NOFREE 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92b9138991dd2829ac744592cb9f9f3415be146c Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=92b9138991dd2829ac744592cb9f9f3415be146c commit 92b9138991dd2829ac744592cb9f9f3415be146c Author: Bojan Novković AuthorDate: 2024-07-14 13:13:56 +0000 Commit: Bojan Novković CommitDate: 2024-07-30 15:38:24 +0000 vm: Introduce VM_ALLOC_NOFREE and PG_NOFREE This patch adds two additional vm_page flags to distinguish pages that never get released while the system is running (e.g. UMA_ZONE_NOFREE slabs). Differential Revision: https://reviews.freebsd.org/D45970 Reviewed by: alc, kib, markj Tested by: alc --- sys/vm/vm_page.c | 13 ++++++++++--- sys/vm/vm_page.h | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 64413ba10bfa..3b6b88e4eb32 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2082,7 +2082,8 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pindex_t pindex, int domain, #define VPA_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \ VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY | \ VM_ALLOC_SBUSY | VM_ALLOC_WIRED | \ - VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK) + VM_ALLOC_NODUMP | VM_ALLOC_ZERO | \ + VM_ALLOC_NOFREE | VM_ALLOC_COUNT_MASK) KASSERT((req & ~VPA_FLAGS) == 0, ("invalid request %#x", req)); KASSERT(((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != @@ -2154,6 +2155,8 @@ found: flags |= m->flags & PG_ZERO; if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; + if ((req & VM_ALLOC_NOFREE) != 0) + flags |= PG_NOFREE; m->flags = flags; m->a.flags = 0; m->oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; @@ -2418,11 +2421,13 @@ vm_page_alloc_noobj_domain(int domain, int req) #define VPAN_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \ VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | \ VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | \ - VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK) + VM_ALLOC_NODUMP | VM_ALLOC_ZERO | \ + VM_ALLOC_NOFREE | VM_ALLOC_COUNT_MASK) KASSERT((req & ~VPAN_FLAGS) == 0, ("invalid request %#x", req)); - flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0; + flags = ((req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0) | + ((req & VM_ALLOC_NOFREE) != 0 ? PG_NOFREE : 0); vmd = VM_DOMAIN(domain); again: if (vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) { @@ -3937,6 +3942,8 @@ vm_page_free_prep(vm_page_t m) m, i, (uintmax_t)*p)); } #endif + KASSERT((m->flags & PG_NOFREE) == 0, + ("%s: attempting to free a PG_NOFREE page", __func__)); if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(!pmap_page_is_mapped(m), ("vm_page_free_prep: freeing mapped page %p", m)); diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 61a0228273c2..07a6c98c8ee8 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -457,6 +457,7 @@ extern struct mtx_padalign pa_lock[]; #define PG_ZERO 0x04 /* page is zeroed */ #define PG_MARKER 0x08 /* special queue marker page */ #define PG_NODUMP 0x10 /* don't include this page in a dump */ +#define PG_NOFREE 0x20 /* page should never be freed. */ /* * Misc constants. @@ -537,7 +538,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */ #define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */ #define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */ -#define VM_ALLOC_AVAIL0 0x0100 +#define VM_ALLOC_NOFREE 0x0100 /* (an) Page will never be released */ #define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ #define VM_ALLOC_NOCREAT 0x0400 /* (gp) Don't create a page */ #define VM_ALLOC_AVAIL1 0x0800 @@ -575,6 +576,8 @@ malloc2vm_flags(int malloc_flags) pflags |= VM_ALLOC_WAITOK; if ((malloc_flags & M_NORECLAIM)) pflags |= VM_ALLOC_NORECLAIM; + if ((malloc_flags & M_NEVERFREED)) + pflags |= VM_ALLOC_NOFREE; return (pflags); } #endif