From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 97FC828D8ED for ; Mon, 16 Feb 2026 17:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771261324; cv=none; b=RHZoidUCV4pqp7Zsq2s8AmkgnRBWSZu6SnfBA6IJDyr/UrPXXCjdPjnzPRW2QZkM8lXTXVOXRLofqdoNkIsMgzHmlyaJIAgC/hTyk9gx3v8pjkKM3EnlUPe1qf7GWka5IogWPjE9FP+K7i1X81uO5kYX1vaQzRObNOJLFrBkMf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771261324; c=relaxed/simple; bh=ZAYe4zzGtKnuiRQp5gdmQyPCKsbtVT5Abd3sDZBcA/k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RTEdTSqUK9xPIHoKW5bG0bxeKKlFdavxLrQn8jCI+PWPvC4++bt4afxv6ZS/hZDrWIDeHgKdQnk8QFvx6Rwct9aYPGT/56UnAuJWxN/8JDE3+ImnFGsC52axVe/VI01W/BStyHzI//sqszdxZ0Dma7ckpsVpR7BuF5XeuwaUH7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=a2+at+jG; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a2+at+jG" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XedH1nC+Gj9W+WH0M+mfk/8Vb36OqwdxoYy659oyHsE=; b=a2+at+jGiBxQTJbRHNdUByoufa uCPBcYhq+SK/7nn5tf81k9Hxm0qmMn6FKSr/YLhQdg1PC4aNGZPjJX5gMITLiiJHqivRP8B0CdpbW +9kVeS0g3VfjlBJ7OzAJaTVV9TYF6DrjfP/2Dt+F1e0dIW7W1grrkFUBsUQDJrjt9+AWnfy/0wF4l OTPUw2OHTOXO6I/z4Wii7qCnQIiSPhRxcZmGrCoFAHYaXNiUPyRMc8rcHUsnqUjkG2Ky/Ug7bBpAe K6HyA0sNoNECypjHQUBPtfUAkgdzHzz8znZlfY7WAZVPq2a7zILlSzJkTVJSatGhtczpNaWw93YDU AkWmewvw==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vs1yp-00000002jxW-3VHP; Mon, 16 Feb 2026 17:01:52 +0000 Date: Mon, 16 Feb 2026 17:01:51 +0000 From: Matthew Wilcox To: Kiryl Shutsemau Cc: Wenchao Hao , "David Hildenbrand (Arm)" , Andrew Morton , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Add AnonZero accounting for zero-filled anonymous pages Message-ID: References: <20260214084514.2842745-1-haowenchao22@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Feb 16, 2026 at 04:54:05PM +0000, Kiryl Shutsemau wrote: > What I would like to see in the kernel is a syscall that return the > memory stats in binary form. Something like > > size_t memstat(int pidfd, struct memstat memstatbuf[], size_t n, > unsigned long flags, unsigned long start, unsigned long end); > > The syscall will fill up to n memstatbufs, one per-VMA. What exactly > filled there defined by flags. The return value is how many memstatbuf > is populated. The caller can call it multiple times to walk address > space it is interested in. > > We also can have a flag that mirrors smaps_rollup behaviour and collect > all the data into a single memstatbuf. But is that what we want? Let's say a process allocates a 2MB THP, uses 12kB of it and then forks. A lot. Now all children that haven't called exec() see the wasted 2036kB. Would we rather have something that scans (say) the LRU list looking for zero memory?