From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 E9CF9441605 for ; Thu, 9 Jul 2026 18:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783622461; cv=none; b=bIy+iIFa4Hoi5LbhWsBQvfsjDPSEPanZ7Q+yons1AemHrc9yvdGfxbITM4Nen6uyNrMtzAF+YDu9kbkMxiOp1XBTY4NnmxVstRdgSmdQUsBB+dkijtYX03YQgNK+vMuuXZVJkkNXX3TVkHwDeUzG0hN+q094Mkmqvg1UOiLtruo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783622461; c=relaxed/simple; bh=nS6XChxiER0uI1ARmk0U21VTQqbYFZmEw+C4XL8XT7c=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=uz3/KFeXiceirMQIu1Jqhmu0FtvE5jr+rETmrN6kZGLNKG0/TcQxWMm/4IfpzrAbEQQea3xZlc7hT4K0tOddACR7tmRshB1ChM1QN7OZGhNC39PZVSOVsYyTAbIqYp9G+1GN+mWy/mkXZ7Bqz3BiKvo1N09ugCQb9ofR34Hy0ww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=fLM6MjaP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="fLM6MjaP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C871F00A3F; Thu, 9 Jul 2026 18:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783622459; bh=rYrqKyJcarkPc3ot8aQvhf0e9iwthKczmlyiuvPt6L4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=fLM6MjaPetUInIuGrh5P5aAaYIHFgG/X7H+VK0G+FB2uoe0TC1exsmP1HRqUA5g7B VWxhAqVi3XKOJZn0P7koDAQSrKcfmv5GpiGHQr6OczkJLUwd4uM3rBLEDuKDUWw+kc Q7QbWwC8csiqlxarxL6YAI8nc/JPz8BmmXulTs+Q= Date: Thu, 9 Jul 2026 11:40:58 -0700 From: Andrew Morton To: Zi Yan Cc: Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , David Hildenbrand , Lorenzo Stoakes , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Mike Rapoport , Dennis Zhou , Tejun Heo , Christoph Lameter , Alistair Popple , Usama Arif , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 0/5] Keep tail page private zero at free and folio split time Message-Id: <20260709114058.52eb184d1529a247993ebdf8@linux-foundation.org> In-Reply-To: <20260709-keep-subpage-private-zero-at-free-v3-0-7e4fe155f5b9@nvidia.com> References: <20260709-keep-subpage-private-zero-at-free-v3-0-7e4fe155f5b9@nvidia.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 09 Jul 2026 14:06:00 -0400 Zi Yan wrote: > Hi all, > > This patchset makes sure tail_page->private is zero before compound or > high-order pages are returned to the allocator. It also checks tail pages > that become new folio heads during large folio split, before their private > fields are used by new folios. Updated, thanks. > Changes in v3: > 1. replaced "it" with "a DEBUG_VM check" in Patch 3 commit message > 2. moved tail_page->private bad_page() code up to the existing > is_check_pages_enabled() block in Patch 4. > - Link to v2: https://lore.kernel.org/r/20260703-keep-subpage-private-zero-at-free-v2-0-2970fe777dd6@nvidia.com Here's how v3 altered mm.git: mm/page_alloc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/mm/page_alloc.c~b +++ a/mm/page_alloc.c @@ -1386,13 +1386,14 @@ static __always_inline bool __free_pages bad++; continue; } + + if (tail_page->private) { + bad_page(tail_page, "nonzero private"); + bad++; + continue; + } } tail_page->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP; - if (is_check_pages_enabled() && tail_page->private) { - bad_page(tail_page, "nonzero private"); - bad++; - continue; - } } } if (folio_test_anon(folio)) { _