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.133.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 4259FC15C for ; Mon, 8 Jun 2026 19:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780948514; cv=none; b=XJlsNUB6j6VswPTLsdgxsLuR4oNA/0oHye67QQ7lSaw1aM5ukTJDTY70i8QgmTrQ7k6mY0ZLZH5lJ7j0lQYRUtBCZY28Hgd9hf0VLthmmxEi16ENbWDmW8loB6HHWJQgWGQnBJhSUkaSM7XF2dfTs+cWg3P9QQ1tN8IpD866Qgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780948514; c=relaxed/simple; bh=JXA3s4ch667vnuxWsX8i4Su/Y69iMX7B+S7Lg/Adh1s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NwHQ/bMFfX5KGJCKbQr6YfeS1FHZLJ26+jcbrj8Bb+LqUUypHyBZBE3hL6IozFd18jo2uwfgfMYxaXOlu5Lhqkg4A+y0txnJiY8iCu+kcP7knGwmHxYSoJq4Qf4l1xKabX+a+hNdeYc36z02wOoESabZ/S8Ir4Dor/6TApXPvhs= 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=cLC7nm8R; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=IAGtoCNs; arc=none smtp.client-ip=170.10.133.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="cLC7nm8R"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="IAGtoCNs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780948511; 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=cLC7nm8R0eyee8Xudge+IbgElf3JfJWuxAdd+8kfklL2261erbq32EJlX+cfHb3MyaqzVQ +weWyhLL+xqBFWA15RaMktnRgUVILGKhzEU7LPsBs+mBcmS+vH+dArIGONH2FHPABG/NY5 RdGeWsiOhICU4Uw4oSMlE5B6bSXoY3c= 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-312-l6tCYvN1NIiQn4fbNyghDg-1; Mon, 08 Jun 2026 15:55:09 -0400 X-MC-Unique: l6tCYvN1NIiQn4fbNyghDg-1 X-Mimecast-MFC-AGG-ID: l6tCYvN1NIiQn4fbNyghDg_1780948507 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-490b8adf8b8so43444565e9.0 for ; Mon, 08 Jun 2026 12:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780948507; x=1781553307; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=K1EvdDcjngGB9YGnsiekH6IRPqxO13+zTlrf/+W1zqA=; b=IAGtoCNsquwtCvEp5V45RzFtPeqDRx6HK8eK5c8f4ZSLHvVwN81PTJP6a1iTbIHrLb h058o74Oi7gzEEXsmldsW8U0AzIKaw3HSJbthRkdFzMcObnbTWcM2O6wbuRoRi0+16h1 9WTJL/I16S0UK0374JmBRh3H51JGUnlb27dULVOY4nCR4u5LPS8YEYben4byS+LJe8Gf 8w/P3ak+ny1+I/KBQLOGa4LQwECEW9vyXgdFj4vPG3YNox5I+1aGAw4u0hnjmU66sBU6 X0VMwzJlTsuKS6U7dD0Zd2EizpRxqXgKdXfYtj4F2En70sXle/u+XZ930TZH4PomBC6A uPzA== 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=i7z1T6cQleAfY57QoFYgr8cCL38fb+5jt+bzvVq/YDsyPPeoY9tddvCkX0nVrRNE9Y q7RmkXH0rFXDZ0zk/rk/gvTWv/pDj/Foh7mBwAstNTcn9RNV5l5olUjBdgeJN0Rr6+o/ ROuzCj9bzVMTo22z/CfD1YJ5L8Orpy7GvqT1qvLXcxEywpOcpAIauRHF5pqqceQsLBhz oK+PAqoI+eq2RHvJ9VEtQNtXBoAsouvOla605M9b7MOhnD2nisGZyIev+bpFE4p3vMk4 UmfWudJGkjJEjitQfRcWHNasorB3aOjeJj0Vgvzm0jlY6aEHUOgfz0MDAC374Pm+appt v24Q== X-Forwarded-Encrypted: i=1; AFNElJ+VTrZalEfWpTaVipeA3c1qc8MF+1wS/WtWo7JF90xP9h+5ZoigkIfl4Jk0wb6MOB6VWgBgyFpaXVyC2bc=@vger.kernel.org X-Gm-Message-State: AOJu0YxzqJp1ohDGJif4satfqRlG8p+d3BijDYc29HdN+NZCK0YlNiMP GXhC6KXgWDKStmBzTmUlB5d+BhXbES1u9h3jOGVXnARzIGwSKihv2HvlI+T2kpErplnM4MgHvgU 2KX60kvQF2/FxP9Ee+pbep2B1656ISJkF+5CUWVa/Ew7+D5WvjD07qPrsUPiCtO+hDA== X-Gm-Gg: Acq92OEEgtTvuOUaaoouHUx2Jl7i7HqaxAQ0HV5kswZWyQEvoY2dc0ee0kKIGsvAanM lSj1Aq50HtD+LChCd8M7DpEcMmTPpgzASMXTImyh5H3m9L+UPJ+xlIjL6x7R5R1LAHekweykTUa XGGgY8R93rTX8uItw6K/hGlNJDM0biwSlNXErcDAAIx0gHYp8AYxKbtZJ/Xt2+tR3iKr6uu0zJQ 28O5RVM8xcuOcBTtJ+prB1SW9RWWmSAe6nzyf04BvSCopCzyBnOE3KjNtYTp41ctB/bIiZJY7Ce N7CfCqqym69uEia4xR4IvcqulhSfwqY3WQ42T06bYgWKuUewgDRjk+AoXIX4WTERZQ0fXRxLKO4 Hh0SYyVmmaL3h9+vx6FYTsbUIUr73Tg0AEMGnBQwL8KlwcR+2UCIHTQ== X-Received: by 2002:a05:600c:a117:b0:490:c2a3:23d0 with SMTP id 5b1f17b1804b1-490c2a32441mr202152525e9.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: 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, 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