From nobody Mon Aug 24 20:49:55 2026 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (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 2FFE83C4172 for ; Wed, 5 Aug 2026 17:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785950996; cv=none; b=a8qj9p1ezB8UUZnngVMi/0pAPnpi2YKeYSfgCbpwxA5xuBcnDs8Yxc2Udcj7vORRD6eoaL3HO3oJ8t9s/lmudIF2/wHnh/3sMjG/393wY62CWvu7czDNL3ju9DRPiOTrY5pPx/2sVh4DhoFULVzIf666WAjbKU+mW2z5Pq2MvNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785950996; c=relaxed/simple; bh=5FMwOERpYxxMKr2Yzjx3moxBSEA3jcNJqG3HGHQMhS0=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=GR4TMx2MDB7gChU6tt83IqmuIfSPctEDuUe9A9Mb10jn3PjTLI5tUybC03ACJ5JmasguqlMxsW5svC8zt+uFX1rUMvks1wgqWlw6l8ScaFMBUNk45cZS5T77YWKBWHkTpW35g4fpCzkJK8Bg5uImah0sLxsWU5U1dbfYa+1cRMw= 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=mj3httLw; arc=none smtp.client-ip=209.85.215.197 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="mj3httLw" Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cb6ef846b33so71404a12.1 for ; Wed, 05 Aug 2026 10:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785950994; x=1786555794; 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=xDb6UVUUSmRTt/O3cIrZaFoVx9KXsBi3AsTvyG9chiE=; b=mj3httLwOVuC0Lt8xojbaq5fjj+G6JbKV5pgKgYWmErN8ZxSFLpuZBvEqo4lGMP1an 6ciXQf8eQ2PW6VB3+Q494rKs5D3HC7ux2D06vGnethNjuyxrPY8EHRo2LEgnQSrkPz2P ebQ2eSXvYOD0ZAP9jwI6AWX7fdAFjtAkK0Omo9gslkC6qPLrg5HkHzC0Crrt05lqBLrm hvpe/vXXLIF5KzYYimQu4F5UmEPFvKUMQ9OjyxxQaBaQkou+BIzx46boLVQf2GrW+4JJ pEs8w5E3zhXothoYCXNpgljxITHjnyZhQ/JxPKsHvpRl9YnK70H1/UZUubTHBZCqFLPE wcnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785950994; x=1786555794; 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=xDb6UVUUSmRTt/O3cIrZaFoVx9KXsBi3AsTvyG9chiE=; b=UZvL5Rc3JlC4TBt5lc6iOUqxV/b8i5W/O6W1Y2UNnXqOXAewaaAjg2UBE8+2vnp+W9 +JC4SmCqKZhYxJ8hRonD7QvaICges8pWn008XO6DP6F1SlEUQyIyNRDy1wjsieuar8TZ EiuOneYreJe5vEojj56qCO3gV7LJ1Y2kfL1dwZGhsWrpv/S1vhOI0HX19YCZcaet2YQk GZxz+bNCUbBh8i1s5Yq0t4vbEBvaysRLUIUbTNx7z2PR0QpPvRVYPjszpHbdDugcayT0 ejsGhV2D4g6MbxFIqH5yeabxlNmOMa9dN6vpe3r7dBSGNXcpnPS3+GiGxXvQG7w+Tp65 O4kQ== X-Gm-Message-State: AOJu0YzSvi77WEGNZBGu2V1dctV0gH3+X+VX0HEnxHwsLYbKVsfkNrJk tBiJ0HJA5eW6IOi6CNoBYXdw+flN8QgkhPeiX6wtiGwqj3EQY5uFnlgEBGDv8wGrjv3IjbaU1Ct l2tti4YWjP3cKS1awkIEH4p/xymny3IuMzA== X-Received: from dlbsi11.prod.google.com ([2002:a05:7022:b88b:b0:13e:596e:f99b]) (user=abhishekbapat job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:a97:b0:3c4:3750:2c03 with SMTP id adf61e73a8af0-3cb9c1a2a27mr962641637.9.1785950994364; Wed, 05 Aug 2026 10:29:54 -0700 (PDT) Date: Wed, 5 Aug 2026 17:29:52 +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 v5] alloc_tag: expose boot-time compression configuration From: Abhishek Bapat To: Suren Baghdasaryan , Andrew Morton , Hao Ge , linux-doc@vger.kernel.org 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. Add a new read-only sysctl representing how compression was configured at boot time. Signed-off-by: Abhishek Bapat Acked-by: Suren Baghdasaryan --- v5 change: - More documentation and commit message refactoring. v4 change: - Documentation and commit message refactor. 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. Documentation/mm/allocation-profiling.rst | 11 +++++++++++ mm/alloc_tag.c | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/mm/allocation-profiling.rst b/Documentation/mm/a= llocation-profiling.rst index c3a28467955f..b2ebcef8af6f 100644 --- a/Documentation/mm/allocation-profiling.rst +++ b/Documentation/mm/allocation-profiling.rst @@ -43,6 +43,17 @@ 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 alloc tag compression is enabled. + + 0: Page alloc tag compression is disabled. + + This reflects a static boot-time configuration of how page allocation ta= gs are + stored (in page flags when compression is enabled and in page_ext when d= isabled). + Toggling ``mem_profiling`` at runtime does not change the state of + ``mem_profiling_compressed``. + Runtime info: /proc/allocinfo =20 diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c index 84c5c3783ca4..b33410310477 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: a946fa1d96648b92c9f37f0488e0e47a85f9e235 --=20 2.55.0.508.g3f0d502094-goog