From nobody Tue Jul 30 15:38:44 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 4WYKBr6g4Zz5RRRN; Tue, 30 Jul 2024 15:38:44 +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 4WYKBr65GVz41wN; Tue, 30 Jul 2024 15:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722353924; 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=QSpWo1o8uOsi+MBV6DEV56E9wyg9HpwfcI9z2HxfXso=; b=RqS/eqrBeKuBM1rOhsA+0e085BjM/qcIcG8lSXlh2fFllcGCt44DKfMYbzq8jO1nKvKcHP L1ri8tycffIlLPttoZCf5Sdb8Tj5Xt9AOl+B8DbGF9nVl96uQYNCI2+B5/e+r0rmJ8kgM1 5KjxGbGSHpjeUx3MthoMjhN5nkYCKAw3Y51iVqG4gKrWb4tPx938xczgxCkbxL8QJP7mZe c+2GumhJ1WfSmh7/rmize2RP9EtPtANHwYqCHvGpksi5I4+sD6tq/BXqOPomzsCT3vyOCA X4RLcDDUn5jeem+aRq/K6v4oIo+ptS3LTQdv7K4mwRRvfqbJyl8gtyAnq6irkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722353924; a=rsa-sha256; cv=none; b=RbCEk1WBD448D7I+O7HcpaGEyVKCopASTN2IBWDqbJFh2x5mOl/tFwF61tj4ErxUSWW7FO Bj12ts8xESYeo0FrsgJ1iYEVKQgZYUxPgpOMJumzrqLfgCtq3BqIq8V9Y1JO55kURTLeTh ZtZk0F8SBZlA8FfCV/SC/oawpzQgGA29koTwJe0ADFrkAfotwbPUiFjcplMXVJhNL9fMJ8 Ta3SxFa+as1KWe2ZKOZb9DiUh0GaeGAvUVW50GakXW6IjmK7Up1a4Z/4mYqYau08w34PN6 e95t3Zd8T29a852Ty/nC+buwV9Vn9XVQk/8Bx5HxvxoCzz/5KMG70e8BXbkznw== 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=1722353924; 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=QSpWo1o8uOsi+MBV6DEV56E9wyg9HpwfcI9z2HxfXso=; b=cjQX447/1MF40M0ssRFGss8Ju1CE2NreZrEm3dHwd8scPkFax21GU3PmE7A5IWDTNIT8nj C7ZwWtIzswN8mPqrDNRl014zLX6C6tO8L925A6h+DReUMoHLPGIwBym422hpszFBRjE4y2 ZrRHG5CGpxnHCYXWpW7Wxa5pFhnwKHYd4KA/BCTm9DtrGZ/gcEIrFhUZ/t1xf0e2v9zcpW pB+p/dHPd4rSIwndJWlvBQnt9uMzb+Nrk3uUZ8dbjwVH2a8gkW5XgZwRABtlvNwsEcf9c8 xa61IY0GvcWxDlEY/D19gv6acpAJxZz62qB8nqgBa1NHy85R/FN5tETMh3HdsQ== 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 4WYKBr5YzxzNH8; Tue, 30 Jul 2024 15:38:44 +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 46UFcihR049501; Tue, 30 Jul 2024 15:38:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UFciDs049498; Tue, 30 Jul 2024 15:38:44 GMT (envelope-from git) Date: Tue, 30 Jul 2024 15:38:44 GMT Message-Id: <202407301538.46UFciDs049498@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: 78f3e0f6b3ad - main - malloc(9): Introduce M_NEVERFREED 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: 78f3e0f6b3ad70d9574730fc3338474376ef8ebd Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=78f3e0f6b3ad70d9574730fc3338474376ef8ebd commit 78f3e0f6b3ad70d9574730fc3338474376ef8ebd Author: Bojan Novković AuthorDate: 2024-05-03 18:18:56 +0000 Commit: Bojan Novković CommitDate: 2024-07-30 15:38:18 +0000 malloc(9): Introduce M_NEVERFREED This patch adds an additional malloc(9) flag to distinguish allocations that are never freed during runtime. Differential Revision: https://reviews.freebsd.org/D45045 Reviewed by: alc, kib, markj Tested by: alc --- sys/sys/malloc.h | 3 ++- sys/vm/uma_core.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index dfd7928fc258..9b281da4b4d4 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -60,8 +60,9 @@ #define M_BESTFIT 0x2000 /* only for vmem, low fragmentation */ #define M_EXEC 0x4000 /* allocate executable space */ #define M_NEXTFIT 0x8000 /* only for vmem, follow cursor */ +#define M_NEVERFREED 0x10000 /* chunk will never get freed */ -#define M_VERSION 2020110501 +#define M_VERSION 2024073001 /* * Two malloc type structures are present: malloc_type, which is used by a diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 516ac2c2965a..e93c561d759a 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1791,6 +1791,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, if (keg->uk_flags & UMA_ZONE_NODUMP) aflags |= M_NODUMP; + if (keg->uk_flags & UMA_ZONE_NOFREE) + aflags |= M_NEVERFREED; + /* zone is passed for legacy reasons. */ size = keg->uk_ppera * PAGE_SIZE; mem = keg->uk_allocf(zone, size, domain, &sflags, aflags);