From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6A34BC15C for ; Mon, 8 Jun 2026 19:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780948511; cv=none; b=VXmGI64uSt2XjyNzf80pxH83ybb95Zub8ZMekiDoaWgaJzgjzvGEDzmpeR9omo3LKjBY8ubv0+hZ5JlTTGvnQDRrPiKArllIyMw2W8ny3/0zIAcnmJUbFIP2yf7pHVwluOAqbok6+Wg4dGT5wKM71O3NmIelAquEcAUk8J0/BDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780948511; c=relaxed/simple; bh=JXA3s4ch667vnuxWsX8i4Su/Y69iMX7B+S7Lg/Adh1s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=Gq/PQNjLYmAq+wJasKCd0bPFplSY81bLhZLKi0sMzXayBGZMgbsJ27dSfBGx7KaOBExOF7uZ+vKCpaZLTQwmxRFwQR5zQdXckVmNnvjtUQMbls8kkg9yq5OIxG57xEiZA1L745PCJhTD0qWKnzC5at/Z2i03bs+oO4zM6yVvTh8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E5ikco8V; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E5ikco8V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780948509; 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: in-reply-to:in-reply-to:references:references; bh=K1EvdDcjngGB9YGnsiekH6IRPqxO13+zTlrf/+W1zqA=; b=E5ikco8Vs5Ubfay2HR/emi18DTrGA1G530CrjJ3Zt4Sl0RM70wq7rcYELJUtvA7oUqNdPA HC2jkXCqEbnVhG0gO/Lr5Op1jzEhNoyrWhETve+h6m7ANacsXPydQS1EO9e3el5sQUapY+ Lx5zxFa8agc4/xaYmR7uYjh1PUSR2KI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-1SEav8BEMLSr-fcxHCz4ug-1; Mon, 08 Jun 2026 15:55:08 -0400 X-MC-Unique: 1SEav8BEMLSr-fcxHCz4ug-1 X-Mimecast-MFC-AGG-ID: 1SEav8BEMLSr-fcxHCz4ug_1780948507 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-490a786f987so53685435e9.3 for ; Mon, 08 Jun 2026 12:55:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780948507; x=1781553307; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K1EvdDcjngGB9YGnsiekH6IRPqxO13+zTlrf/+W1zqA=; b=s2q4Yjuq+5X8KD3JKGWrZZZW4j4v1RCd3uHsJ1838YL0FEIxY9IjefEiAUCrOEnme/ Lv9jPgElBsV1H/J6x5p1pDvQ5An4hSHj+X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b1804b1-490c2a32441mr202152515e9.35.1780948506587; Mon, 08 Jun 2026 12:55:06 -0700 (PDT) X-Received: by 2002:a05:600c:a117:b0:490:c2a3:23d0 with SMTP id 5b1f17b1804b1-490c2a32441mr202152225e9.35.1780948506137; Mon, 08 Jun 2026 12:55:06 -0700 (PDT) Received: from redhat.com (IGLD-80-230-85-71.inter.net.il. [80.230.85.71]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3fd663sm484058135e9.10.2026.06.08.12.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 12:55:05 -0700 (PDT) Date: Mon, 8 Jun 2026 15:55:00 -0400 From: "Michael S. Tsirkin" To: Matthew Wilcox Cc: Gregory Price , Lorenzo Stoakes , linux-kernel@vger.kernel.org, "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Muchun Song , Oscar Salvador , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli Subject: Re: [PATCH v10 17/37] mm: page_reporting: skip redundant zeroing of host-zeroed reported pages Message-ID: <20260608154658-mutt-send-email-mst@kernel.org> References: <6a2f93e4447e55ada6ccf0f4d5c64e8d41a848d4.1780906288.git.mst@redhat.com> Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LUTdwATD4EjvYn4MDdNENNmJNGo7apCr_oDQ7tF8NWU_1780948507 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 08, 2026 at 07:40:23PM +0100, Matthew Wilcox wrote: > On Mon, Jun 08, 2026 at 12:09:19PM -0400, Gregory Price wrote: > > On Mon, Jun 08, 2026 at 01:00:17PM +0100, Lorenzo Stoakes wrote: > > > On Mon, Jun 08, 2026 at 04:37:48AM -0400, Michael S. Tsirkin wrote: > > > > > > > > void post_alloc_hook(struct page *page, unsigned int order, gfp_t gfp_flags, > > > > - unsigned long user_addr); > > > > + bool zeroed, unsigned long user_addr); > > > > > > host_zeroed or something would be more appropriate no? > > > > > > But in general do we need to propagate this around, can't we derive it from > > > the page zeroed flag? > > > > > > It's really confusing as to _which_ zeroing this refers to, it seems the > > > only one relevant here is the VM host zeroing but that's completely > > > non-obvious and now everybody using these functions with the extra param > > > will simply have to happen to know this. > > > > > > If we could find a way to avoid this propagation that'd be ideal. > > > > > > Failing that, making it clear this is _only_ for vm host zeroing would be > > > better, but then maybe we need to think about how we could encode this in > > > some other way, e.g. passing alloc_context perhaps? > > > > > > > This is unaddressed feedback from 3 version ago: > > > > https://lore.kernel.org/linux-mm/agXYbcuQYooG74pb@gourry-fedora-PF4VCD3F/ > > > > We can infer all of this from snapshotted page flags and propogate those > > around. This is infinitely more useful than just a single flag being > > pulled out into a boolean, and more extensible. > > > > void > > post_alloc_hook(struct page *page, usigned int order, gfp_t gfp_flags, > > uint64_t pg_alloc_flags, unsigned long user_addr); > > > > ^^^ page_alloc.c internal falgs only > > > > Once the allocator gets a page it wants to return, it can take a snapshot > > of the flags at that point, and then doodle all over the flags as it > > goes through the page setup prior to return (include the post hook). > > > > Haven't seen a reason why this shouldn't be done this way. > > I'd tuned out this awful series since it'd become apparent that my > feedback wasn't going to be taken seriously. Sorry about that. > Good to know I shouldn't > take it personally because he does it to you too. > > I think it's apparent that Michael has no understanding of the MM. It's a bit of an overstatement but I'm more of a networking guy, yes. What I freely admit I don't understand is why I have to refactor all of mm first. > So we should start again with the architecture. Let's look at the > problem that he's trying to solve: > > - The hypervisor has zeroed the memory that it passes to the MM > - But the MM then zeroes it again before passing it to userspace. > - We want to avoid this > > Let's make sure that's the actual problem before going any further. > Because I do have a design that will satisfy that without doing this > insane level of invasive change, but if that's not the problem, there's > no point wasting my time writing it up. Yes that's exactly the problem I was trying to solve. Early RFC versions didn't do this invasive change: https://lore.kernel.org/lkml/cover.1776689093.git.mst@redhat.com/ But I was asked to refactor mm first and implement the optimization second. Sure, glad to hear what the design is. -- MST