From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 C8EE023EAB9 for ; Wed, 17 Dec 2025 22:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766010220; cv=none; b=KIvtAmSgDBJmQvyudV4fipFqAP2g3m+J8vvjEn1YMh4sKs6Cui9LGmzP6boF2Bef411IxjyucJUe3nlXIXoNFPuVlHuvyt3QCUU+x3vz7k2VHs9dqhiOzp4PAF6C8OOmWndt8KNR4ar8wggXnjDN7nw2hId+NoEFbq+7hWMlSvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766010220; c=relaxed/simple; bh=7DkFJoF0G9hKw2J0EirtCFbMow8bVpd9GWrKH62O0NY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ejvj4xZJ3NlOfn3ZNipQyKkB0dQ/26RJW2JIxZrh8xGO3P7ua0JsmyGfspCIsBnyw0y4Sg+8wK5Kh/upLw0Sa13umr16HDnkIQOiLN8TotNx8X1YHOP47gHNxpoxt/WDtsN5Y8a+5QLgH1wFb4kFYa+u0ryXiNUva7CkXe09TBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=iSrhK6kM; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="iSrhK6kM" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8b31a665ba5so1589785a.2 for ; Wed, 17 Dec 2025 14:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1766010218; x=1766615018; 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=ialel5HFQhh2Hs/dEsLq3bsC4I7cFx6qt8O4tFD/kZY=; b=iSrhK6kMi8Qs+JB5KoStqLqWx2OXj/zHDdfsdKAKjDBWviOwLKIFt6qVS5uj9+mMLf aLK03XFc9IdQkBJjtRiGwNxwbql8MxZTOFP+1zPwwwarz9zWkLPDg5GY83OXSn9L3xq7 1KtzX43prmsKPFDCh6FlqH5rM+QqvPW5v2n5BNy911lgrUCqxcBbI9iG3wuFr+jdYy15 7dpHslJCCNWTvxMwPkoa9CqMrHV4HFLKK9xg6xv+81kssqydH6vK0D7WKrRTCzRgnamg OSSMGq8iy5TnMKBWetoYRuSCDFf8KsIbDgPhlC17+b/SvgT73/XcrjnzKUeD5siVjoT0 4OAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766010218; x=1766615018; 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=ialel5HFQhh2Hs/dEsLq3bsC4I7cFx6qt8O4tFD/kZY=; b=OWT+xqA7cSZ9E2K6+C7cr4mLUbO234kWx6eNbMrIfK76yYugYXbq4AxYGmDFuF66Yb WhR7ORNMeaXPu1uwPeHxQlsnZ5r7O01CqbEtuD51L3js8ONu3N9WZcqeU3jh65r+5EyU wiE8I5YxrumWyStihVZcJfKubjumSg1WRpv2BiiErX1u1u6/zwcMH7S1PlVG26Pf2K/D aANZnmUhqIor5sw5iEUMwDg/NJsRhDHwSA5kSgOikoUk3NUWJy990/9PT2r2pG5W/MY/ ihYwloOD5zbSMlDsjYL1UPRWLI/sOE0HZ8Ji0A5Tm3xlkPd9c7YFy4LJtWd4nAvCFyPP EUYw== X-Forwarded-Encrypted: i=1; AJvYcCULmnGSt+nNIkKmyD4DzCt3YNKpEoLYbwE0vKU+AgE/3xUwnGNFWnMQ4e1h7nlW8CmiCoUGfh5H2iERwvA=@vger.kernel.org X-Gm-Message-State: AOJu0YwC3JkAgSDELS/2kKNEBLg1I5aw3Kiy8kpz5kC2rDo1QS4Q2urU 0vtTBLd4P8gSpTJfYqxQ+G7qQI21z59jrsC3l/1S5KM/q7cKzn7QVziu5UO0uvYngN8= X-Gm-Gg: AY/fxX5MFHYvucIy6RpCFUvkoNOxuxJ5KaLY3cw31F/Il8rcW5hN8GEFtP/ip8NrsSo GcV8ZoQc/vgn7sgkenLu02QtK8SNUzek5a/c5Z+p7Tc9T+dlA5bcxtPSX7rLzP/rciOxu0ndA1p aiRy9T2V7CQaz67dT/yKWctjH0NXSEaTT1KFy9p7D53pVkw6MSH7RA9JnwX1z2DC1EgthJAscuz CBDjTdK14oXL0RZxOCNa7rDrlCIZqe3yGn0xdYb8hgW9BGEF0chcrv3H6I7oSdhBeBn9X/fF4ad 3sSnRjLYze+RrDkqOXXO5PGPsR428bIEEM37dySMjby/fltscTazUlqzNO5oq6zYXGE8ZU7qfTw h1UNSxPbP5INMGPdB69yVDJqkhJpCMK0d7JgfbnM92iYsAehIXoACYBGtyWjnEh/cYES9ZXyEqj shXGcnDUCmjA== X-Google-Smtp-Source: AGHT+IFLj5zSyMWH1DU+HU4kh5upIQXL7c073Q7ukSm1uBP6f4OKMTG1DoPUCq8OYLFaEqdy3dOhPA== X-Received: by 2002:a05:620a:414b:b0:892:90f8:b59d with SMTP id af79cd13be357-8bb397db77bmr2800409185a.7.1766010217662; Wed, 17 Dec 2025 14:23:37 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:929a:4aff:fe16:c778]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-88c6117f54bsm4237146d6.45.2025.12.17.14.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 14:23:37 -0800 (PST) Date: Wed, 17 Dec 2025 17:23:36 -0500 From: Johannes Weiner To: Qi Zheng Cc: hughd@google.com, mhocko@suse.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, david@kernel.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, harry.yoo@oracle.com, imran.f.khan@oracle.com, kamalesh.babulal@oracle.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, chenridong@huaweicloud.com, mkoutny@suse.com, akpm@linux-foundation.org, hamzamahfooz@linux.microsoft.com, apais@linux.microsoft.com, lance.yang@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Muchun Song , Qi Zheng Subject: Re: [PATCH v2 16/28] mm: workingset: prevent memory cgroup release in lru_gen_eviction() Message-ID: References: <86b0573753db20e40315c61f5d6e01bdc6a8313a.1765956025.git.zhengqi.arch@bytedance.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: <86b0573753db20e40315c61f5d6e01bdc6a8313a.1765956025.git.zhengqi.arch@bytedance.com> On Wed, Dec 17, 2025 at 03:27:40PM +0800, Qi Zheng wrote: > From: Muchun Song > > 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 lru_gen_eviction(). > > This serves as a preparatory measure for the reparenting of the > LRU pages. > > Signed-off-by: Muchun Song > Signed-off-by: Qi Zheng > Reviewed-by: Harry Yoo Acked-by: Johannes Weiner