From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4925E3B19A5 for ; Mon, 8 Jun 2026 22:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780957727; cv=none; b=kVQUSx5hgGhrPTMNpP7FX9ThxDwbafZ5z7aUnX7ZsL/k7DWI9+pewRcSpxVvIfDNvrY2DH3sfdi7C6r1Fr6PDfh535WMoSOBGridZBLWdJosvxaZCmoMCcb46SEu7ehaP/Qeq79jpP2bTI/fNA3sFY/b5ICMVh0rGvl3DUtvIiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780957727; c=relaxed/simple; bh=WPVk3fOsviPC5DEcsySe0ug5tCeq3XbI5TttjqERytU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gVkoi2HIWFC+wEOogDc9yap+aHRpfQ4B/+VH8+9Fvna72JYg5psEK2akLjdW+OqB11G/smRnPgcFrSFaf5D37Uxuje3b31t2q4JAzUypaMNNE1s3pd+xWon52Mr1/3lhHCgZNliqAMM46EdoOlq7zy4E4a0uIkVT4DjF8ob/aW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=EuAheV6Y; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="EuAheV6Y" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-915b5ce94c7so341842085a.2 for ; Mon, 08 Jun 2026 15:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1780957725; x=1781562525; 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=/gX/mp9SJHUWlSmoLEXlEEj6nZQtwhCmJ71m3qpbTAE=; b=EuAheV6YFJfAHkEiAsgV9pO38bGhu5ZQe7QsnH7aK1Bxw3nGPUaVwfCWByN3rJlQhd 9eX/RXOUy+W2wMk5P7WO5dd12w/Mr6uV5CfK5QQp1zYMX3UkJ7/CfmlcbbcSieIYJyTV O+uz/IQh6luaQeqlXOs7xu5LQWnYd9a9I69HDwQhBPG83DIHAMFcP/8UPkMXKItbhHHm b2Qdery26LG8urnPUACVNrXCWM8zaI6rNNByinwnFog9ToUDenEpCN4ZMblc79PTzPLD QbSK7gTIzEIUPj7Ne+pkpM6QF6eBSaVZ84B7jwl2htLZE0RU74e9Ra9iOMwkkVrkijCB cMvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780957725; x=1781562525; 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=/gX/mp9SJHUWlSmoLEXlEEj6nZQtwhCmJ71m3qpbTAE=; b=b5M51KPlEwkT1G4EP/8vh5dZedm6zPlzT+VBH7Qc7vqKZH+PRwbj+/a/KjL2y13pvn uDW2ipBmyorhD03g3jwMuSgoDRWFRiXv4MQLCHJgczkEy0amAYybMjLSWrD1aBZ3bSTF TBiSbNGzcq49Lr+srBb9TFt/d3J2PlqYBqwMsNRj3gjjupoeDdxDv19xizoLxv67gUX5 QBp2uAMN0TvXVQOUh7YRPQ2/1B6q0B/+flTyX1tT+i/qh1Mi9kGjZM2jlfI47KLTGuoT Zo/uDdLbUVumMffzIHPJUA89qE7KqRPydnlcQcFRFANyHHyCCLnhQveb9aBl97aGotMu Nkpw== X-Forwarded-Encrypted: i=1; AFNElJ8YKk5jKRsn5Tj19QQ4+6lXMPG6/2DHNPGdmcxUXY1wUhJnQawXRVUV47KV/1ar7xcJSCtSguik0EDefmE=@vger.kernel.org X-Gm-Message-State: AOJu0YyAUmvjNKyfkL7JEJkPC58Xfz650WB6tjYAO1LV52PJeoxzKWfN LtPGMwuSg87o4EKcmV4G10H1kcr+qd6QtgOCgG2c36i1hCfMaxOd3n4twxO7bQT8LSQ= X-Gm-Gg: Acq92OHKDt6GzH/aEAfVUURUHRWMZm236pJRVsK5H1k6Yj1jCV454YgdiZizCiNDF5M WVCbU/Xn7UFHlMn6frffW62a6rMotEI3S8yL+GMylxGbGbpKyNf5a6HXfDAD/q6TkPxnoOsKean Odr7mMpFiDd+6RM5dGLumFOr15xyw1nSqGiUg390ohrgQ2dLEGoceNQpVz4h0qtScJOqVnAZIMv e8eBZakiZg8BSV+UvKjZ2jhyMF9UULz+nM9kQ/XgLV6wI8CmLiiu6yN4KIftiQqpr7g3s7P3dP5 tCdJ9rHCIFOWbNxwKghBqsHVXuxd4vAagG8GAMmvDwsUpD8/Fid1FRJQDq4Xz2v2JyfLyY9wq+t JikYygMrZFMqm7B5qKt/O2ZUmmde+hwVAh2oXMHBTsRYBbF7dIMS33MkklODalnSuZW61AVzSHC xhdLA+vYXeCPnpe9NSXJQiDcvv1LsUUWbiO07TbbRsFpoVG1ZeIE56LAqGc2hFiU59YyTPFWoIr tnxg9bsTmPY0+yWJA== X-Received: by 2002:a05:620a:454b:b0:915:a953:4b9c with SMTP id af79cd13be357-915a9c3659dmr2911955885a.3.1780957725130; Mon, 08 Jun 2026 15:28:45 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a37c645sm1828519985a.30.2026.06.08.15.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 15:28:44 -0700 (PDT) Date: Mon, 8 Jun 2026 18:28:42 -0400 From: Gregory Price To: "David Hildenbrand (Arm)" Cc: Zi Yan , "Michael S. Tsirkin" , Matthew Wilcox , Lorenzo Stoakes , linux-kernel@vger.kernel.org, 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 , 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 07/37] mm: thread user_addr through page allocator for cache-friendly zeroing Message-ID: References: <20260608163257-mutt-send-email-mst@kernel.org> <20260608170348-mutt-send-email-mst@kernel.org> 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 11:51:47PM +0200, David Hildenbrand (Arm) wrote: > On 6/8/26 23:16, Zi Yan wrote: > > There was Willy's comment in RFC v3 [1], which had 19 patches. Unfortunately, he > no longer followed up to my initial push back and Michael's question later [2]. > > That would have probably been the right time to wait for more discussion. > > RFC v4 had 22 patches with little replies. > v5 had 28 patches with little replies. > v6 had 30 patches with no replies. > v7 had 31 patches with little replies. > v8 had 37 patches with no replies. > > [1] https://lore.kernel.org/lkml/aeu5P1bZW3yEH54t@casper.infradead.org/ > [2] https://lore.kernel.org/lkml/20260426165330-mutt-send-email-mst@kernel.org/ > Hm, rewinding on this back to v3 here: https://lore.kernel.org/lkml/016cc5e5-044c-46c6-a668-200f90a64d85@kernel.org/ You said: ``` Exactly, that's why I am saying that vma_alloc_folio() is the only external interface people should be using with a user address. ``` Going through the list of folio_zero_user references: Called unconditionally if a folio is acquired: fs/hugetlbfs/inode.c: folio_zero_user(folio, addr); mm/hugetlb.c: folio_zero_user(folio, vmf->real_address); mm/memfd.c: folio_zero_user(folio, 0); Called when user_alloc_needs_zeroing() and charging passes: mm/huge_memory.c: folio_zero_user(folio, addr); mm/memory.c: folio_zero_user(folio, vmf->address); No one outside mm/ should know about this interface at all. Arguably none of these should know about this interface either. The appropriate place for this logic appears to be: vma_alloc_folio alloc_hugetlb_folio alloc_hugetlb_folio_reserve The reason to sink it into the post_alloc_hook is to let the buddy decide whether the page actually needs to be zeroed (like the virtio situation) based on PG_zeroed or whatever. It seems like at a minimum moving the logic all the way into post_alloc_hook lets us actually delete folio_zero_user() as a published interface and move it entirely within page_alloc.c. The catch is user_alloc_needs_zeroing() coming along with it. ~Gregory