Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4B041337699 for ; Sat, 18 Apr 2026 07:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776498518; cv=none; b=mOaMug3CdlUT9p7xiZMe55i6qrQM+g/oYz+sqAhy9KgcFe2JrUcJe47M/t3pwCcxYUGRLyiZQlyICD6rSYEPkxbnoN7jpztHTTI3XKu5EoCMaiYEBosGOUb6CVlhtSuCo8fwf7vGk7wA/0ezELpfHixfrC8kGtZgXulZjN0AtIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776498518; c=relaxed/simple; bh=GhjoUriInEi51KOhAPCd43LVgSTInmzL0kNDoLabqRo=; h=Date:To:From:Subject:Message-Id; b=iXxD+6WBTujfrhzooYX46Mr4TgP1gsnQMD8w4Zq40ZaaDmlaovdNV1QCM9IVL0RDsw8uUVxt3WwjGUT4ArOzWZ+8qF0nKUq1F96jfLBaLwOUWjPWg7+DM0+/bZq+1nnwAFA/PH6h//L7r5Xvq6B7f2ZyhHbpxGoCUJiAlr6sTK0= 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=jst3yEX2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="jst3yEX2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D6A6C19424; Sat, 18 Apr 2026 07:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1776498518; bh=GhjoUriInEi51KOhAPCd43LVgSTInmzL0kNDoLabqRo=; h=Date:To:From:Subject:From; b=jst3yEX2Pc0W5wrvyrlXZ1AgoSoEMLf5xahxkL6hif8i8C/FDXHJx+NQ7EzbKbvN1 uYPHeah2sgqT9TFvo/EuHVHw5b32vwsSTzvlKtNCKDv+VgxBZNVamEnR43+esODlJt v4RrVPN5sinUGDH76J0PQDbtRcSVZNRKRSGHxqqA= Date: Sat, 18 Apr 2026 00:48:32 -0700 To: mm-commits@vger.kernel.org,ziy@nvidia.com,zhengqi.arch@bytedance.com,yuanchu@google.com,yosry@kernel.org,weixugc@google.com,vbabka@kernel.org,usamaarif642@gmail.com,surenb@google.com,shakeel.butt@linux.dev,rppt@kernel.org,roman.gushchin@linux.dev,nphamcs@gmail.com,muchun.song@linux.dev,mkoutny@suse.com,mhocko@suse.com,ljs@kernel.org,Liam.Howlett@oracle.com,lance.yang@linux.dev,kamalesh.babulal@oracle.com,imran.f.khan@oracle.com,hughd@google.com,harry.yoo@oracle.com,hannes@cmpxchg.org,hamzamahfooz@linux.microsoft.com,david@kernel.org,chenridong@huawei.com,chengming.zhou@linux.dev,bhe@redhat.com,axelrasmussen@google.com,apais@linux.microsoft.com,songmuchun@bytedance.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] mm-memcontrol-prevent-memory-cgroup-release-in-count_memcg_folio_events.patch removed from -mm tree Message-Id: <20260418074837.2D6A6C19424@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: mm: memcontrol: prevent memory cgroup release in count_memcg_folio_events() has been removed from the -mm tree. Its filename was mm-memcontrol-prevent-memory-cgroup-release-in-count_memcg_folio_events.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Muchun Song Subject: mm: memcontrol: prevent memory cgroup release in count_memcg_folio_events() Date: Thu, 5 Mar 2026 19:52:29 +0800 In the near future, a folio will no longer pin its corresponding memory cgroup. To ensure safety, it will only be appropriate to hold the rcu read lock or acquire a reference to the memory cgroup returned by folio_memcg(), thereby preventing it from being released. In the current patch, the rcu read lock is employed to safeguard against the release of the memory cgroup in count_memcg_folio_events(). This serves as a preparatory measure for the reparenting of the LRU pages. Link: https://lore.kernel.org/dea6aa0389367f7fd6b715c8837a2cf7506bd889.1772711148.git.zhengqi.arch@bytedance.com Signed-off-by: Muchun Song Signed-off-by: Qi Zheng Reviewed-by: Harry Yoo Acked-by: Johannes Weiner Acked-by: Shakeel Butt Cc: Allen Pais Cc: Axel Rasmussen Cc: Baoquan He Cc: Chengming Zhou Cc: Chen Ridong Cc: David Hildenbrand Cc: Hamza Mahfooz Cc: Hugh Dickins Cc: Imran Khan Cc: Kamalesh Babulal Cc: Lance Yang Cc: Liam Howlett Cc: Lorenzo Stoakes (Oracle) Cc: Michal Hocko Cc: Michal Koutný Cc: Mike Rapoport Cc: Muchun Song Cc: Nhat Pham Cc: Roman Gushchin Cc: Suren Baghdasaryan Cc: Usama Arif Cc: Vlastimil Babka Cc: Wei Xu Cc: Yosry Ahmed Cc: Yuanchu Xie Cc: Zi Yan Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/include/linux/memcontrol.h~mm-memcontrol-prevent-memory-cgroup-release-in-count_memcg_folio_events +++ a/include/linux/memcontrol.h @@ -975,10 +975,15 @@ void count_memcg_events(struct mem_cgrou static inline void count_memcg_folio_events(struct folio *folio, enum vm_event_item idx, unsigned long nr) { - struct mem_cgroup *memcg = folio_memcg(folio); + struct mem_cgroup *memcg; - if (memcg) - count_memcg_events(memcg, idx, nr); + if (!folio_memcg_charged(folio)) + return; + + rcu_read_lock(); + memcg = folio_memcg(folio); + count_memcg_events(memcg, idx, nr); + rcu_read_unlock(); } static inline void count_memcg_events_mm(struct mm_struct *mm, _ Patches currently in -mm which might be from songmuchun@bytedance.com are