From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=203.254.224.24 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793160263; b=vK9zhTPBt9Nn+frPZRMfFVouOdwjTblIC4fhNDVfSTquiw4Ux020Zm+6gzb8Uwb/hOcn 7QH/7JfsZVOMGKqa9N+dbTwgYfEyrk40UD1ptge0ceFR+eb4V+LKabk9Z55REelp37fAl zV4pDyGaoGXLAWlaflcJnVJel965LiMuNKRGDVebfek8AbV/Xp4AjsiC69Wb4SrCFIec5 LSDnxDcbA4/NdlHEyHOrHThDw9vnh3vn9xG/oSw8BfqpnQcTVkzAnFMwbOLPTNem4vYtw B+EGzKVNEVIBUT6cVa/vPyzS51GQ5pjnvCV5SpW00vESI3IPKBrvwKVGIYm//9UCqjw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793160263; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Received:Received: Mime-Version:Subject:Reply-To:Sender:From:To:CC:X-Priority: X-Content-Kind-Code:X-CPGS-Detection:X-Drm-Type:X-Msg-Generator: X-Msg-Type:X-Reply-Demand:Message-ID:Date:X-CMS-MailID: Content-Transfer-Encoding:Content-Type:X-Sendblock-Type:CMS-TYPE: X-CPGSPASS:X-CPGSPASS:cpgsPolicy:X-CFilter-Loop:X-CMS-RootMailID: References; bh=s+iZWCpgO+SWu6sydNQvWF6mQUcVR5AF+EnQF8o0seY=; b=PzDbNT0urMtFsverx0Fz4iHJ44L42WkqQ3rte3Z2oToK9JO5JHowDuoEHwmcNpOr7zE4 3ol0aq51O7uNZHGMCSFP/LpJ3NlxMHFsELR24sgNTjqbg257z0oIt+H4QEfZWoBh7rFrc nThHYg/a6ASyG2fMvaFGPTOeZvLqzwuIQz8AQU7sDuLhe79fQQfmulA/QV6F8dzgQNAVI kNcprCfa3z/7jG6iS6bfrtC1yt5B3FagV8ACNX7Ub/EGPP0YkaksENbycWsHebFXmWpbf 0vBNtfalKc/fOHlmJ+IKHmAKt3fGcpfekaHuWEBbUOztFC9dClpWO/g+jnto+rhDXcw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=nurJA4ZA; arc=none smtp.remote-ip=203.254.224.24 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF786606A31D for ; Wed, 28 Oct 2026 04:04:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF786606A31D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=nurJA4ZA Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20261028040419epoutp019491850e66e1b7e571364c096017d046~ilcFzXZ4K2531425314epoutp01I for ; Wed, 28 Oct 2026 04:04:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20261028040419epoutp019491850e66e1b7e571364c096017d046~ilcFzXZ4K2531425314epoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1793160259; bh=s+iZWCpgO+SWu6sydNQvWF6mQUcVR5AF+EnQF8o0seY=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=nurJA4ZA1svBQxeg9XDU2IjpzLe/OalE7Z2Om7r0tfgeGF8IRySYIMCeweNm84ZX3 WikvIHfv5/BWLvSZPnZbjZwgD969WHf6t9Y+DGXIV20FWKKW0Fvkj6T6fah7I32jen p4W23Z87fCyWV4H4cPl+wSzYJhsB3cfDFdmbACgI= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPS id 20261028040419epcas2p1f7fc59ba2429938da022a301f337fd64~ilcFQaNwF2264722647epcas2p1i; Wed, 28 Oct 2026 04:04:19 +0000 (GMT) Received: from epcas2p1.samsung.com (unknown [182.195.38.211]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4jDtz66Scqz6B9m4; Wed, 28 Oct 2026 04:04:18 +0000 (GMT) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Subject: Re: [RFC PATCH v1] mm: memcg: skip frozen folios in page_cgroup_ino() Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: "escape@deepseek.com" CC: "akpm@linux-foundation.org" , "hannes@cmpxchg.org" , "mhocko@kernel.org" , "roman.gushchin@linux.dev" , "shakeel.butt@linux.dev" , "muchun.song@linux.dev" , "david@kernel.org" , "ziy@nvidia.com" , "willy@infradead.org" , "linux-mm@kvack.org" , "cgroups@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Daejun Park X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d@epcms2p7> Date: Wed, 28 Oct 2026 13:04:18 +0900 X-CMS-MailID: 20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y cpgsPolicy: CPGSC10-223,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d References: Sorry for the new thread, I was not on Cc of the original mail: https://lore.kernel.org/all/20260907124001.1544655-1-escape@deepseek.com/ On Mon, Sep 07, 2026 at 12:40:00PM +0000, Tao Yi wrote: > When a large folio is split, __split_folio_to_order() clears PageTail > before copying the original folio's memcg_data to the new folio. Thanks for tracking this down. The oops reproduces on 7.3-rc7 here. I wonder if the fix belongs on the split side instead: - The window exists because the split makes page 1 a folio before its memcg_data is set. Before commit fa23a338de93 ("mm: separate folio_split_memcg_refs() from split_page_memcg()"), memcg_data was set first. - A zero refcount does not always mean a split. Large kmalloc pages are frozen but charged, so /proc/kpagecgroup would report them as uncharged. - print_page_owner_memcg() reads memcg_data in the same window, and the refcount check does not cover it. Copying memcg_data before the smp_wmb() in __split_folio_to_order(), with a paired smp_rmb() on the reader side, closes the window for both readers. The same reproducer ran 300 s without an oops with that change. Would you consider a v2 along these lines? I am happy to test it. Daejun