From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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 8260140FDB1 for ; Mon, 11 May 2026 15:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778514851; cv=none; b=eaeDHLgmPw3MK0VnoKDeemXurWraaAnbEWU2/ushqUFhgrVupt0CU+fUgYx4uyAE14ViwSqcy5LZdmdCfi8pMv3YrN1nJi48+WF185V5HyetqOsIoRcCDw30Q2mdhqPXH2EHD50EpHqZcu2OuUZBg7QEv76w/qY238mpvH+IArY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778514851; c=relaxed/simple; bh=aiGFJQW61WDqG9XpD7Ci1ql3gHNF+E9K3gUxwH/LCHs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q8VZNIsxn0JNwNexhrXIbLb0cVPTtPIIS4lcuigDZ1CGLzFMyNDEaSsJKktfOmi1lKpD1KEP51boB6CeUHQQyqA0Z/3+T4LHVu7NZHBT61fuKz6B0z2Kwespo1G0NVAXfWhlLerL4iyjnRMiJ8fRfM1YCgk6dWUP0SCXj48PcK8= 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=PV0vI5gm; arc=none smtp.client-ip=209.85.219.46 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="PV0vI5gm" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-8b7dccd6fe4so33358096d6.1 for ; Mon, 11 May 2026 08:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778514846; x=1779119646; 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=20yoGM3whVtKvNYZZgGIezStzCSDmI46twhVwHYN4Ew=; b=PV0vI5gmZNQjIavfS8V+NuUSC4J66lbz4So1tba9kTNuy2WR5ZbwOURqQNgZLxCkfC NMKECHR75njCXXIWvA+IrdzbsckoPXYJoWJscF/PF4clP6JysTZVCS1nInarqUy8otH0 Tdr1mYt3vzovyh7iRkW20/uoyDEvSGIP/gr1oHXDmDFgA8KdIEjmGNMi4FwWjpOQ8ZFb lMBL3Mvfj0colrOCYE1bEjlVJ8jVQTtCuJleHK0gBr/fUEw6qojNaS6FyBBluQApzvv1 SJQEz7P8dX4RbNCvP03Db/Zwe5goxv8S6ZUJdy4VIlTWudX06oL7Wh7ZtG0UjOO26xHF SUig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778514846; x=1779119646; 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=20yoGM3whVtKvNYZZgGIezStzCSDmI46twhVwHYN4Ew=; b=j5rfTZLcZYOoJtpszDwf0v5RRWvNaBSvzcF/KMdT1gKDbl/WpgRGxK5riKU033pJE3 xSuGK+KdLVQ76CjbDdaadtguJJ8NanDflJfEDdnDDloX/+xdfJ+my40A8BCc8f2VnEuy NyGX9jn/D++ftSRs9LnOmqykSjovidgU1w8YDmBGWJ6+lEQA5iM0EBM0yV/zmpvE2Xme oc/AAX8PWPYBJuTxWXbU/DyjIVCElysCxR00NYxn9p7y8psz35hWhgAuV9K2xzOb3cGQ JKyi81PFLRMOaukMSaYLCQ8VHXEpuSsIdHphVmKBtdOGXV3uiZOA8EIvs9u3FFOYC4FK C4uA== X-Gm-Message-State: AOJu0YyKIlFleenzYrIJc66Wa/b4URQh4EN9qqmBLFxWZA2bdjLmprVY 7PgFlXrt0lyzKQxWNefxvhfZnvjb+mstmi3t5p/YqwM8sWTf460OxggoW6i6l3JjaPk= X-Gm-Gg: Acq92OGQW6U3tu1OcU29ivqN5nW7f0qDRq3USofcCSMu7TVhC8LAI+T6+Eq4sYxgzfO G1+It9tyekCsynV0xZRiCv+is0REsOXvyT2Bu4YXr6QOFTWviQn5lMsuSm5IlFHXh48lQVgmgsZ wUcESwmftrnrzUtR1gBYdp3xIlzkVBx0rKualRO07iIb2Z7Pqn4UVnGEB4t1p4ocUwK118C9yQs arlWin7TXFDDTYGQD5+/Rg0uwLTqhXhCcBAbun9KTfNgqZCR98ygz3gJoh0A/0oaWwziEatFp53 vuzQCHWg30uscddAENU+dQUOX9c/6Lc418PZ6mK6DsWMTU1zbdl4qb6CsIBuIJKg+okdKK9GbgU MpXOWAb4/J+1iBnRh3jBVYVymJ4Hlgvez3xPx6X6wftrDfEkkMK/h9nXoYBhHA2ezN72kapMi3v 0UscmyqhNelORDOj+qL3jusYMHD1VqM2xATo/NoFKpMgFJN0dXMO+9QEtXyeo/ARmOOt/aGf2e4 ntZChs3s2yb X-Received: by 2002:a05:6214:c45:b0:8bd:7192:9506 with SMTP id 6a1803df08f44-8bd71929608mr325423396d6.7.1778514845601; Mon, 11 May 2026 08:54:05 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-100-36-248-188.washdc.fios.verizon.net. [100.36.248.188]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8b53d831ac7sm309701326d6.49.2026.05.11.08.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 08:54:04 -0700 (PDT) Date: Mon, 11 May 2026 11:54:02 -0400 From: Gregory Price To: "Michael S. Tsirkin" Cc: 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: [PATCH resend v6 05/30] mm: page_alloc: move prep_compound_page before post_alloc_hook Message-ID: References: <6345727fdfa76157ba0518e2148d1848e0bdbc16.1778489843.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: <6345727fdfa76157ba0518e2148d1848e0bdbc16.1778489843.git.mst@redhat.com> On Mon, May 11, 2026 at 05:02:06AM -0400, Michael S. Tsirkin wrote: > Move prep_compound_page() before post_alloc_hook() in prep_new_page(). > > The next patch adds a folio_zero_user() call to post_alloc_hook(), > which uses folio_nr_pages() to determine how many pages to zero. > Without compound metadata set up first, folio_nr_pages() returns 1 > for higher-order allocations, so only the first page would be zeroed. > > All other operations in post_alloc_hook() (arch_alloc_page, KASAN, > debug, page owner, etc.) use raw page pointers with explicit order > counts and are unaffected by this reordering. > > Note: compaction_alloc_noprof() has the opposite ordering > (post_alloc_hook before prep_compound_page). This is fine because > compaction always passes USER_ADDR_NONE, so folio_zero_user() is > never called there and folio_nr_pages() is never reached inside > post_alloc_hook(). > We can't really know that this will stay true forever, may as well change the ordering there to prevent a tripping hazard. Possibly you might want to just squash this change with the next patch and add a comment that the ordering is now explicit and required that way to be correct. (possibly patches 4-5-6 should just be one patch, since it's all really the same change, but 4 seems fine by itself). > Signed-off-by: Michael S. Tsirkin > Assisted-by: Claude:claude-opus-4-6 > Assisted-by: cursor-agent:GPT-5.4-xhigh Reviewed-by: Gregory Price