From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 813683CF206 for ; Tue, 9 Jun 2026 06:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780985942; cv=none; b=FUwqaAQWSEWoY4NNtautbEQOrE4y+qkUmAaN9infxTCcvzVDMnAu9tTCfQalwuErIDPhFs3fylq/UXnEf0tFY6RffNu13C3J7vxE+TXv4iNCS4R70N6OWsP7G6S5NgsNOxVJWymVXod7mZhhV7QznNNA5a90YHX9VwSDZeaYDrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780985942; c=relaxed/simple; bh=2V4VNjsLWZcueXCFHd09srlb7WUAcIZjCm5t+Nylnt4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lXzqbLsG2Ie9peSgbtedjfN8xaccJ6RbY60IXNHGZ3IBM07HekaI+ePBB6/8MKGQwKFNeWuCF5qDx4OuxK8R+8crq6iM9fzq69TdpU/Od6pfp5AUuri2A7wbNxgy3nz3aeBwF2zkQ1BhI1+4DN8C73Spr5CZeKYPLwsAMK+SCX8= 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=h9iA4P4F; arc=none smtp.client-ip=209.85.222.179 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="h9iA4P4F" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-915aa0a9293so443403385a.1 for ; Mon, 08 Jun 2026 23:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1780985940; x=1781590740; 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=WyHS2mdLzaoQuFPek2z//fxHK8pVAjskPhevZrWWAyg=; b=h9iA4P4FD8eeFFzm07TKAtn0lh0KxDr777uxwMpmD+k80eU6WUM0EZlu85W7c8rc3x cKtQbXOz1AO9nSr71vEiSaQdXevZB7hmojxpbMwyATl00WCvoZs/TkodaDAhTgkRcZAO U4hNWQHEa6TBFmqNf1A2PGhJOZAQIBS9ICxaxALTGzGJaOKdw0hmZ7HPdzPzh9Mbx72C GS64WdLALmhS4oS+j1XHYQjVx9cRnEkCapt4iXxjMtfFVtwa8MbXJyMx3K3MLLTtuX1H Iz1aHJTNXF8J/xzhCRMhAx7oGVH5JtqDBw+7DhXKi6YZYOVpDbl3IgCdCxcf8zNS/PE4 Xfrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780985940; x=1781590740; 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=WyHS2mdLzaoQuFPek2z//fxHK8pVAjskPhevZrWWAyg=; b=Ztm1WdRY8VFSazo9MZ1Ynm7mw5mHigS5LLL/HLTMMpOno/KfWxHGbeNMC+/rLzRYNQ 6N+JrDtmn+NE0XmEXxqzB91k0UoyuO2DuxEk3IO+aR1bK7uUgKu+VV04n7Oc2zM/omzM x2YFhbEw31Umc+oa4cx6f1qbQPnzlfvDnnkiJ7e4c84dBViODrTTSh0cw5uM0PZmSTUt 5QHNAjopvVXouQwPxUC+cTdUR6bW/nzr5jyK8Z59McoK8mgi4KR96KHbLfdgVRDXJHpQ G9Fm+jWmfal0x1pki2jKPmCfcJ4z3D975Pp/gRLwGSvJOmP37MIBZNdhhdDLMwrUIQ72 jZHg== X-Forwarded-Encrypted: i=1; AFNElJ8DISey+uhBgmK3tpwJQayzAuqSZVK8BeSQ+hOF0tNZcw9CQFIIHdRJ4OHUAI0IAaRln0CfZ2cHUbr4yoA=@vger.kernel.org X-Gm-Message-State: AOJu0YxjC/6CNRzBzCTNpzNmmGhXRinA3skkSBnzvLf4L6YAmCcj9RSt 9SsCYhzMxxE7PgRbaHc0zzafXLe0eVlnlLR1Jy6e7iB2f3RJPdwro7+VDER9PZFx6co= X-Gm-Gg: Acq92OEIMGTuKMzoCC6Fkdo631uRpZ3yw26jlJlN5t55FJJGXuKH5C2XocncO9dQDyq h+dL0IAS3jq6vEzWTpz98DqOTzuk596Gg/5NryY4+Q0yT1iVrU0Dim+/Z2GhAH8x+SioskwHSX9 6ldWO1ja3ew5NCYZGPAY3KHS0F14E4gLYACNgpWyhUJdT9/eRLBpwDizCbRcOiZhxa+DtUq0Z3l /2XzquHH7rhiOnan/bdZueDhSsw3Jpe/bjtWl+vAEk/Rt5i/7Pwk8o1ofDb2d1Wa6u15dZ3M5Tg vwjT4OzNmp0BEwIiwytABJXsTykObP+6FifiyuhTLhPCigstpapKO5GI3qvk0hj/Q6wp/zk4+hM +xaDUxVV52FqlggIVgqlwoX1JwvZK6KeT3Ut/i4lIv5PcWKGq6H+J7QF8iCP466vCnDyLbNQOti kSfgkvb/7f7f6VAQ3yxC+xIs2YOV+lVvdjbBYbKKemCRrMHFYtn/rDf8rJ039N36C1uDly35fpY mNuyXDjBNsOuv9ibA== X-Received: by 2002:a05:620a:4511:b0:915:9931:3a3e with SMTP id af79cd13be357-915ad1c091bmr2206391685a.27.1780985940133; Mon, 08 Jun 2026 23:19:00 -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-9158a2465e7sm2045397885a.19.2026.06.08.23.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 23:18:59 -0700 (PDT) Date: Tue, 9 Jun 2026 02:18:56 -0400 From: Gregory Price To: Matthew Wilcox Cc: "Michael S. Tsirkin" , 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 , Lorenzo Stoakes , "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: New design Message-ID: References: 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 Tue, Jun 09, 2026 at 04:58:14AM +0100, Matthew Wilcox wrote: > OK, here's how I'd structure this: > > 1. Introduce PG_zeroed for buddy pages > 2. Set it if init_on_free is set > 3. Set it from balloon driver > > https://lore.kernel.org/lkml/c7094de807c0e963526686e1d245bc76193b1a92.1776689093.git.mst@redhat.com/ > > but add FPI_ZEROED instead of an extra bool parameter. > > 4. Introduce page_is_zeroed like this: > > static inline bool page_is_zeroed(const struct page *page) > { > /* > * lru.next has bit 2 set if the page is already zeroed. > * Callers may simply overwrite it once they no longer > * need to preserve that information. > */ > return (unsigned long)page->lru.next & BIT(2); > } > > (you'll notice this is similar to page_is_pfmemalloc() but it doesn't > need to be in mm.h) > > This step is going to be a bit fiddly. We weren't expecting to return > multiple flags in page->lru.next, so clear_page_pfmemalloc() just sets > page->lru.next to NULL. So somewhere we need to make sure that > page->lru.next is definitely NULL, and then allow both the zeroed and > pfmemalloc flags to be set in it. > > The important part of this is that it allows the zeroed flag to be > returned from the page allocator without introducing pghint_t like you > did in v2. > Are you suggesting leaking the flags out entirely, or just to the boundaries of page_alloc.c (__alloc_frozen_pages_noproft and etc). I assume the latter, but worth clarifying. Otherwise this seems reasonable. If we're just going to pile more stuff in lru.next you might as well either add the alias to mm.h but keep the bits defined in page_alloc.c to prevent them from escaping (even if they end up set, nothing outside page_alloc.c knows what any of them mean). Unless my read on this is mistaken, let me know if i've misunderstood anything. > 5. Now you can start skipping various zeroing steps higher in the call > chain. > > I understand David's disgust with vma_alloc_zeroed_movable_folio() > but that is surely a separate cleanup and nothing to do with this > patchset.