From nobody Fri Oct 2 07:46:14 2026 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D8BA3033E6 for ; Mon, 3 Aug 2026 21:54:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785794099; cv=none; b=BGUsmUZHb5PN1nXlGdUJ9aWIAMkzqUYd04jJWPaYCV9UYfRJ1iuHDzsyK+nNYhRDx8WeArZyxmZdtvtSmL18J7OqDk6annbQm/SS/Uana1k2bAw6IG7KkX4WBHeJAUEhYcrLd43DDPFA4oB5wbEW81+Na4hwvGQvvZZX7YunJX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785794099; c=relaxed/simple; bh=l1S4oARnIitk87oQ8lROv+gCVeLk6j2HfPm3mOBIXO8=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=i8cf6V+Je6vz6VoVPzdRjrp2Nf4vGosnx9FUYH6N38zsj0oGx7kpfh5kAtff1stv2TXxy4EFKXeLhD1Jryobzj6RG2JJRbubNZvVlNvkFVt3zyo2lyrQXWND7F0cxJR/Q/+3gjmRwDe3Q+s6ZfdomBXKVwPD1YHTnkh52ZaFz/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--abhishekbapat.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QrOJtPlG; arc=none smtp.client-ip=209.85.216.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--abhishekbapat.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QrOJtPlG" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e11baa66eso3770262a91.2 for ; Mon, 03 Aug 2026 14:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785794098; x=1786398898; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=gSBooIlJf3UAkzT4nWmRIwMiBklsMyQf8PbFU/y+GgU=; b=QrOJtPlGp18Up7s2+FoBibI0OQsNBPKtY2ff3wvEfN8+Fu+tzxeRG1lh3YbOpxFPn9 IOwaMDCP5CJdCvVmIg/Mc2CDUaNf+XQTkbMYiJhVofUa4v8Tyflu3FshSt1pukM3gTqg u+krE0eQfr9ex2VKGHchFQAKzh2kfG6V6lB+pxMgp5ekpbfEV0EgodPZOojlYYtTZ4zc FL71btIWNjs2Ku6c3myN+Z6gOk6qKyzIVGtYijUcFR8C853obnoMhW/zG46/QckWyvDV 2Xqp/EMQ8HRq+ym4N5nZfxeOL+S09AEN3vTHaKQUBqp8tv7OAWWZWxnIPc5tzfqxKrkE gMHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785794098; x=1786398898; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=gSBooIlJf3UAkzT4nWmRIwMiBklsMyQf8PbFU/y+GgU=; b=EhVpxii13cexiXQNC3P00Tbr6aG28VT5WwmHMBvQaTlgL+Y/v1RHBDXkEHYe63xkGp ack5t1+9HI620sdisE6bKiVi/ikE7J+aQk0SUB1x7yPRTS/bn/fURFKIXXy4keB7s5Sn gfibQKjJlkJFA8KJCGFwtVgdEGalENLQ4WdbX5vldz34QbSna+aCpGBSpPQPs8gssDDe ik9CdTOFRZ9HDzoFRlZJHm8XCy9ew9hrA60fz3/dRU2fqVQmkQ/UU9L67HR7vZq4Tt25 vxyJmbeciIR3iZ1skOmRc4LvO8V23B8p1PQ6tuN8qabYt6CqFHiWyJqn88P4x2P4CK97 Oyjg== X-Gm-Message-State: AOJu0Yy6iED6HAptz2MNzGIEKbN+8Mc+3ZFczryFGosb+r0FhRfSHNue O7zHQIdsiB+L6x+FtCFowazGTOLu4Fd9kwFCl6hbOFyfjjoxh0WEClf6HniR/BGCSoVUYpzghhE ZH9D+GGsWcA2CXRL454qzmfAKPd2o7NBFJw== X-Received: from dlbrj9.prod.google.com ([2002:a05:7022:f409:b0:13b:2a58:e5fa]) (user=abhishekbapat job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1dc3:b0:387:e0db:bc28 with SMTP id 98e67ed59e1d1-38fbc554637mr10362140a91.40.1785794097472; Mon, 03 Aug 2026 14:54:57 -0700 (PDT) Date: Mon, 3 Aug 2026 21:54:55 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.508.g3f0d502094-goog Message-ID: Subject: [PATCH v3] alloc_tag: expose profiling and compression states From: Abhishek Bapat To: Suren Baghdasaryan , Andrew Morton , Hao Ge Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Abhishek Bapat Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, userspace has limited visibility into the exact active runtime state of memory allocation profiling and its page extension compression ('sysctl.vm.mem_profiling=3D{0|1|never}[,compressed]'). While reading the sysctl provides basic on/off status, it is currently impossible for userspace to natively determine whether page-tag compression was successfully enabled without scraping dmesg boot logs. Resolve this ambiguity by exposing the active compression state by adding a new read-only sysctl `vm.mem_profiling_compressed` to output the state. v3 change: - Added documentation about the behaviour details of the new sysctl. v2 change: - Moved from displaying the state in /proc/allocinfo to a new read-only sysctl. Signed-off-by: Abhishek Bapat --- Documentation/mm/allocation-profiling.rst | 13 +++++++++++++ mm/alloc_tag.c | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/mm/allocation-profiling.rst b/Documentation/mm/a= llocation-profiling.rst index c3a28467955f..3ad1e9aacb9a 100644 --- a/Documentation/mm/allocation-profiling.rst +++ b/Documentation/mm/allocation-profiling.rst @@ -43,6 +43,19 @@ sysctl: warnings produced by allocations made while profiling is disabled and fr= eed when it's enabled. =20 + /proc/sys/vm/mem_profiling_compressed + + 1: Page extension compression is enabled. + + 0: Page extension compression is disabled. + + This control is read-only and reflects the compression status initialize= d at boot. + Note that, unlike `mem_profiling`, which represents the current state of= profiling, + `mem_profiling_compressed` represents the state configured at boot time.= Turning off + profiling at runtime will implicitly make this sysctl effectively dorman= t. However, if + profiling is toggled off and then toggled on again, it will resume with = compression + still enabled as long as the value of `mem_profiling_compressed` is 1. + Runtime info: /proc/allocinfo =20 diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c index 52aece27b00e..877068241f06 100644 --- a/mm/alloc_tag.c +++ b/mm/alloc_tag.c @@ -1303,6 +1303,12 @@ static const struct ctl_table memory_allocation_prof= iling_sysctls[] =3D { .mode =3D 0644, .proc_handler =3D proc_mem_profiling_handler, }, + { + .procname =3D "mem_profiling_compressed", + .data =3D &mem_profiling_compressed, + .mode =3D 0444, + .proc_handler =3D proc_do_static_key, + }, }; =20 static void __init sysctl_init(void) base-commit: 94f9b3980dd446b56acf1dfed649e9b32a9f3813 --=20 2.55.0.508.g3f0d502094-goog