From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796102718; b=ZOsCK736kKoCoLB40a2JiAkkYi2Fzgn3FyLfpnDzLkK+LShMnl+0Pi1nG8ZqXqrzJ21O xjgVLBeNbmzrM3Y7cexH47BFG0dQouCkpWtQNIelXJKQ8WxUiU92jSAX4z1n5nTA5LPH+ anw7DhnPyFtdleqQKjPF5ZLNUztBAmgOx0ZKrFoOIhOZ789cD4/kfNjdmRdpyW4enu+2x maR2FocEoccQxN3LI66T6qNIhP46x5s2m3+C+fzhLEOD9ZONkkjI0g/1Phbx36wr83HQM 1duTUWXb/XZulS1n4cHQPQaq94+c9rtcxu8XyQmBxqaez6uAdpFHcuc7P2E52HONqbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796102718; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=iWgBWUYNCP6s9KwKHXIHnyHbhwknrklo3ybSsZJbNiI=; b=Bkwljkk/0XbmvtbVGGlQbYW5+4eqWtpecUKvRQzWZ8k98bSafdVE8iB7hzmqpUjn+w/n iXZtLMl/mI6mlJtBREvg7K840FP35dYWGQKp+h8aK61nNgDy9Gn9K9aP3eVG9jYgWroV7 SkywgRaoNlVb7SjAIWQkdpgntSsNI5OZ/GWmhzxQlNvbtPSlP6MwoR82Vr/piPwJqqx9J irUcSIpenO8bY6lkIsrVFpEY6t58TNiv8hBx8zuvyXb+KUXq8h/y1wbElGNQVNsmezIX2 a5Ykec+fXc3VWz6MWpVJwH3eNy+gv79Vf2FhBABGYbcVar0zrvcDaHMRPRB8fxaVpHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=kAgLCMCc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CBC7606A325 for ; Tue, 1 Dec 2026 05:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=kAgLCMCc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C2CA1F000C1; Tue, 1 Dec 2026 05:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796102718; bh=iWgBWUYNCP6s9KwKHXIHnyHbhwknrklo3ybSsZJbNiI=; h=Date:To:From:In-Reply-To:References:Subject; b=kAgLCMCchL3UzLIviit9WJeMpoHp0Wm+ZgzO3HA2wLo+MUedaJg8pNqYjaXo0nnwu WxpjPQIGHIt/2Q1oVHX4BQEpESho4QQE8voK2XOOvb28Qw31bN+Is935L5uBMUco9g 4++YxKfmNz/o/4QWIvAGFMF78/FuScvgTL0pJMp4= Date: Mon, 30 Nov 2026 21:25:17 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,willy@infradead.org, vbabka@kernel.org,usama.arif@linux.dev,surenb@google.com, shakeel.butt@linux.dev,ryan.roberts@arm.com,roman.gushchin@linux.dev, nico.pache@linux.dev,muchun.song@linux.dev,mhocko@kernel.org, liam@infradead.org,lance.yang@linux.dev,kas@kernel.org,hannes@cmpxchg.org, escape@deepseek.com,dev.jain@arm.com,david@kernel.org, brendan.jackman@linux.dev,baolin.wang@linux.alibaba.com,baohua@kernel.org, daejun7.park@samsung.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261104-kpagecgroup-split-v1-2-f70e947fec85@samsung.com> References: <20261104-kpagecgroup-split-v1-2-f70e947fec85@samsung.com> Subject: + mm-page_owner-also-check-pagetail-before-reading-memcg_data.patch added to mm-new branch Message-Id: <20261201052518.4C2CA1F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/page_owner: also check PageTail before reading memcg_data has been added to the -mm mm-new branch. Its filename is mm-page_owner-also-check-pagetail-before-reading-memcg_data.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_owner-also-check-pagetail-before-reading-memcg_data.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Daejun Park Subject: mm/page_owner: also check PageTail before reading memcg_data Date: Wed, 04 Nov 2026 18:59:09 +0900 print_page_owner_memcg() loads memcg_data before it tests PageTail(). In the first tail page, memcg_data holds the folio's _nr_pages. A split can make the page a folio between the two loads. The stale _nr_pages then passes the PageTail() test and is used as an objcg pointer. __split_folio_to_order() stores memcg_data before the smp_wmb() that precedes clear_compound_head(). Also test PageTail() before the load, with a paired smp_rmb(). Keep the test after the load for a page that becomes a tail in between. Link: https://patch.msgid.link/20261104-kpagecgroup-split-v1-2-f70e947fec85@samsung.com Fixes: 4996fc547f5b ("mm: let _folio_nr_pages overlay memcg_data in first tail page") Signed-off-by: Daejun Park Signed-off-by: Andrew Morton Reviewed-by: Zi Yan Cc: Tao Yi Cc: Johannes Weiner Cc: Michal Hocko Cc: Roman Gushchin Cc: Shakeel Butt Cc: Muchun Song Cc: David Hildenbrand Cc: Matthew Wilcox (Oracle) Cc: Baolin Wang Cc: Liam R. Howlett Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Barry Song Cc: Lance Yang Cc: Usama Arif Cc: Kiryl Shutsemau Cc: Vlastimil Babka Cc: Suren Baghdasaryan Cc: Brendan Jackman mm/page_owner.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/mm/page_owner.c~mm-page_owner-also-check-pagetail-before-reading-memcg_data +++ a/mm/page_owner.c @@ -564,6 +564,13 @@ static inline int print_page_owner_memcg char name[80]; rcu_read_lock(); + if (PageTail(page)) + goto out_unlock; + /* + * Order the memcg_data load after the PageTail() load. Pairs with + * smp_wmb() in __split_folio_to_order(). + */ + smp_rmb(); memcg_data = READ_ONCE(page->memcg_data); if (!memcg_data || PageTail(page)) goto out_unlock; _ Patches currently in -mm which might be from daejun7.park@samsung.com are mm-huge_memory-set-memcg_data-before-a-split-page-leaves-the-folio.patch mm-page_owner-also-check-pagetail-before-reading-memcg_data.patch