From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 6976223D7FF for ; Fri, 31 Jul 2026 02:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785465743; cv=none; b=S9Gf4ILe4cuJn0JUTBdsHe8t5+JPbe8oPkRwMONgdeK0Fe2J/Z3YjvGSgFiBbDYTAeUHnODG0XYBfMjlgxlvYQs93P/22A+0lxhs9/PhMEJ2k1SsMLzHwm+bvFbgnnNFWGHDKMOpOYXOZW+DHgDZ+Jc9aIWuwqxGcm880SslW40= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785465743; c=relaxed/simple; bh=RfT2ohpZYtIWfUgSW0gjxJWAVo3uHwIITi2Qck/TdR0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=od4wCH5QsCENdtgRsLxIB2KKE567kwT5skWRnxzD5uVfw5RXspHBwL0yjcJ4xUVtGV6tuE+jvPSAZodadbJQT8sYQoJJ0oKQEY1cc3T3U+mbpvSDLwK/R7fu48rzf6OAvjCZP/Fkx078l+dY1V9Abpl5kfZoP7IDIlhpywWHjKE= 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=L4fSBc1D; arc=none smtp.client-ip=95.215.58.176 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="L4fSBc1D" Message-ID: <0dcd8c2c-d841-47c2-997a-640d1937a77a@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785465739; 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=+5vd8Y68OMp3ByY8Fv4tlZIkUBxHvZtmlUKnrS2bYAc=; b=L4fSBc1DvMrziitlgcvvYvoyw+1c+owjsre19jDjKLmbac9gNbGjJza6q2XyhHXK4PdIxp 5HVFgNrXnpAsAqrDG3bQNXoFzu0DKejya/6H1/GUswGQnlp+X1OYKgOPxrCakdQZ7k4QL4 k1/qplv5HTcXShgA+3l5floNc6hHmyQ= Date: Fri, 31 Jul 2026 10:41:52 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2] alloc_tag: expose profiling and compression states in /proc/allocinfo To: Abhishek Bapat , Suren Baghdasaryan Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton References: <0d84763f140ea735d790e0b30a8e954536beb875.1785455267.git.abhishekbapat@google.com> 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: <0d84763f140ea735d790e0b30a8e954536beb875.1785455267.git.abhishekbapat@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Hi Abhishek Thanks for the v2 patch. On 2026/7/31 07:48, 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.memprofiling_compressed` to output the > state. I think this should be vm.mem_profiling_compressed. Otherwise, you will need to adjust the procname for this new sysctl accordingly. Also, kindly add docs at the linked path. https://elixir.bootlin.com/linux/v7.2-rc4/source/Documentation/mm/allocation-profiling.rst#L33 > Signed-off-by: Abhishek Bapat > --- > mm/alloc_tag.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > 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, > + }, > }; > I think adding this sysctl alone won't be enough. If we set boot arg sysctl.vm.mem_profiling=1,compressed but profiling gets disabled due to insufficient page flags, this sysctl will still report 1 (compression enabled) even though profiling was shut down. To verify this behavior, I have set up a test environment locally as shown below: [    0.265503] 4046 allocation tags cannot be references using 5 available page flag bits. Memory allocation profiling is disabled! [root@localhost ~]# cat /proc/sys/vm/mem_profiling_compressed 1 [root@localhost ~]# I'm unsure whether we should initialize this sysctl when profiling gets disabled at boot. If we do, we should set mem_profiling_compressed to false in shutdown_mem_profiling. Thanks Best Regards Hao > static void __init sysctl_init(void) > > base-commit: 2ed26e8a624f41887d64e2e37a2f6ab36a118d1f