From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 856C72F7F10 for ; Tue, 4 Aug 2026 04:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816912; cv=none; b=SywzBriid6qyeg5vxt9BSHMtR7kWekGUe74Dh/WAo7xRnCxtvgW21rdsijAxm8q7+TP1ZFmH9tSf6OTozNV5Yy+r27xGUf5BinXVDdubgt6CzXsgOw3tYV/AHp7T9h6nVx6Xxl+uMSTEFUjc7p4sDkYHyXIqXSUOP/UoFZyYp9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816912; c=relaxed/simple; bh=U7r64gbyuLxdexx5AOKuhNkS2wdfElb5HNyqZitFOlA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GUXqU2TMrFjfLKl9bzRbJu0yyLp6820tZkpx/9+MoeTOM2MfaX9ZH6P5w3Vlh1mfOvx4iUVOgsLkc3bjOq5ECSsI9gU9z+qfAwaM+002SK4vt4ToCDLysITCaC3wnDvJphTZuqu+SjEAjriO/GVtxVCl4SyQPA6pUlCwv3mJ4rQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jXAJo2n/; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jXAJo2n/" Message-ID: <7eaf894f-5824-47e8-bcb5-94c0aad52e8b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785807671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ps1Dri8UzSB1jjTvWRqSQYPr91u6L8+5z9psY43bCwg=; b=jXAJo2n/7Gy350ZhhSbx7e2YAEQsX+iOt0Cn1Ss7DMlkV+xkRsdz8HOnQedDKhCy7RXRgw KKPEA9NoIZeFnHCVz4RaQBruRzlz9jY5j87TyFg5xiFL0qftMHeI+UEImNudBTq88LgpEH 1R273tJiGML9EU9cmVjNHg6BNWN9CAM= Date: Tue, 4 Aug 2026 09:40:46 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3] alloc_tag: expose profiling and compression states To: Suren Baghdasaryan , Abhishek Bapat Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Ge In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2026/8/4 08:30, Suren Baghdasaryan wrote: > On Mon, Aug 3, 2026 at 2:54 PM Abhishek Bapat wrote: >> Currently, userspace has limited visibility into the exact active >> runtime state of memory allocation profiling and its page extension >> compression ('sysctl.vm.mem_profiling={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 > "Resolve this ambiguity by exposing the active compression state by > adding a new read-only sysctl" sounds too elaborate. This also > conflicts with the documentation you added which states > "`mem_profiling_compressed` represents the state configured at boot > time", so your description of it representing "the active compression > state" is incorrect. > How about: "Add a new read-only sysctl representing how compression > was configured at boot time."? > >> 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/allocation-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 freed >> when it's enabled. >> >> + /proc/sys/vm/mem_profiling_compressed >> + >> + 1: Page extension compression is enabled. > We are not compressing page extensions but rather page allocation > tags, so "Page extension compression" is misleading. I think "Page > allocation tag compression is enabled." would be better. Agree. The commit message describes it the same way ("page extension compression"), so that needs fixing too. Thanks Best Regards Hao > >> + >> + 0: Page extension compression is disabled. >> + >> + This control is read-only and reflects the compression status initialized 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 dormant. 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 >> >> 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_profiling_sysctls[] = { >> .mode = 0644, >> .proc_handler = proc_mem_profiling_handler, >> }, >> + { >> + .procname = "mem_profiling_compressed", >> + .data = &mem_profiling_compressed, >> + .mode = 0444, >> + .proc_handler = proc_do_static_key, >> + }, >> }; >> >> static void __init sysctl_init(void) >> >> base-commit: 94f9b3980dd446b56acf1dfed649e9b32a9f3813 >> -- >> 2.55.0.508.g3f0d502094-goog >>