From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 112AE36C0DC for ; Thu, 30 Jul 2026 02:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785378189; cv=none; b=azPOs2TQmLWM5JjXPFTO19qmF7BUKeJRtWBqN1clxNpIzPiBAK25VuDOfL1V6EXHliaHqasQCrNslSFXPR8agQmn+piPSWX3kQpzmwmbJTeQ61w+iCypNUlaKeat0bWpj7iHS6Az1rzqK/a2FXFj4lot1DrfGbHwI1MdsSv5zkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785378189; c=relaxed/simple; bh=lXXr8qjA2IPfxWQbXhY2OpVy4ILK4coUzELUDbgbydU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hPzveuBgTaCOjCK28eJ71fUEgqJhxj/zV1CZfynn/rigcxgw3nPV71QZJ1us4stDg3JxIuRGocWeHQLLEuxwOUmNGlJTn6HJ94NL2gwb1P1h0ibL9/n6W/TkFVArex/vM2NGl7pRkPLGqNIMmUlBBjMqWACz9V408KGnhvba2Rg= 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=aqUhF1r8; arc=none smtp.client-ip=95.215.58.180 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="aqUhF1r8" Message-ID: <729c578c-e5a3-4351-b07b-469f79c26b0d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785378182; 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=0OzJvIZWBkrlBUTwSYt4KpI5s4IiGKcT+hyE09Mh85Q=; b=aqUhF1r8sA+y1aEGzL5mQ/o0SlE42ZUyiYPmyX4DvA2xKhPbDojKhJ7qCHB3LPxZ0AGR+b hfVUsumPeyusmh6hxUHvoZZkj7WQqUFGaJXDJ1r6tRggQ6/fvvc0g/Xt84Tncsxne+3rJ2 O4kxF1JHqFvaVVkwFcAx47k4br5ZBlI= Date: Thu, 30 Jul 2026 10:22:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] alloc_tag: expose profiling and compression states in /proc/allocinfo To: Abhishek Bapat Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Suren Baghdasaryan , Andrew Morton References: <2614a3a2f5cb11b63e3cacdcc8ab20a0fe7ae972.1785365110.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: <2614a3a2f5cb11b63e3cacdcc8ab20a0fe7ae972.1785365110.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 your patch. On 2026/7/30 06:49, 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. > Furthermore, since /proc/allocinfo remains in the procfs filesystem even > after profiling is dynamically disabled at runtime, simply checking for > the file's presence does not reliably indicate if the allocation > tracking hooks are actively running. > > Resolve this ambiguity by appending the active state directly into the > header of /proc/allocinfo. It's not obvious to me why userspace would need this state. Suppose userspace reads mem_alloc_profiling_enabled as disabled, then the profiling gets enabled later. All allocations generated during that intermediate window are lost. When users later cat /proc/allocinfo and see the enabled state, will they mistakenly take the output as a complete, accurate record? I'm also unclear what userspace would do with the compression state; this is just an internal implementation detail of memory profiling. Put another way, personally I'd prefer /proc/allocinfo to stay lean and avoid exposing too many internal implementation details to userspace. Unless users intend to dig deep into how memory profiling works, these extra details will likely only confuse them — most don't care about internals at all. It's similar to how we use APIs: we only care about what an API achieves, not its underlying implementation. Could you share the concrete use cases for exposing these states to userspace? Thanks Best Regards Hao > Signed-off-by: Abhishek Bapat > --- > mm/alloc_tag.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c > index 52aece27b00e..89ec2c6ce57a 100644 > --- a/mm/alloc_tag.c > +++ b/mm/alloc_tag.c > @@ -108,7 +108,11 @@ static void allocinfo_stop(struct seq_file *m, void *arg) > static void print_allocinfo_header(struct seq_buf *buf) > { > /* Output format version, so we can change it. */ > - seq_buf_printf(buf, "allocinfo - version: 2.0\n"); > + seq_buf_printf(buf, "allocinfo - version: 2.1\n"); > + seq_buf_printf(buf, "# Profiling: %s\n", > + mem_alloc_profiling_enabled() ? "Enabled" : "Disabled"); > + seq_buf_printf(buf, "# Compression: %s\n", > + static_key_enabled(&mem_profiling_compressed) ? "Enabled" : "Disabled"); > seq_buf_printf(buf, "# \n"); > } > > > base-commit: c73b725a57f276a3702ca213bde78fca029bc619