From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 91CC53CC327 for ; Wed, 24 Jun 2026 14:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782312126; cv=none; b=pymmCWXnDaz1/sSNsL/u2qa2m5ivHfDjSKczqzM704oNdiT+482csyPDeQZjy1u13S3BYr/Msa3vinQAhMj5FpuHvr0Y/KLxUFMZhig+Fz8Q7rrqpYWSlAbkhqegP6sjKFmK4phKw56yqYqJDwRzGKDoK6igXZnFTJgg0cOMQQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782312126; c=relaxed/simple; bh=L3rORlljL/OA6AwItWCm0gcxHNbR6neqiv0JhQvckcM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=N9yTQmeWbc1oegVwJysVlEQzZzgJmtV14Tw3ssqeME+X2fz4K0UT1PtOlLzCQS15sP5ZHs+UID7Sf98HelpI+my3eKIyXHMhnRWLzQm34CPPLNkheVkiZeT2uXhKSJ4nhJ/SPvGZZYgB8wbp2W3q1VXSkGlfWR06+dzBronU2N8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NMYyA2Vz; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NMYyA2Vz" Message-ID: <9abb91a4-1990-40d6-ae36-53ee2add765d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782312120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xecAOTCurKESIMIgUzS8m+lTP6YeTvYRkWiz24CsRnc=; b=NMYyA2Vz3iRqg0pVeiFzkpqoEMuDTwjDkyW8yNeKWS8yXpDEC4H0JaSx2Hf5d6SaHkHvdY Yg92UrHTuZtAfR6YRSjNL74hOIB4GFnWvcqNEwCtrXpROidU1lyP1xGHleMB3AN5t+kmqi YD5k3guCfi/VHklBAFzrOYyK+UtosEo= Date: Wed, 24 Jun 2026 22:41:18 +0800 Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 3/3] memcg: bail out proactive reclaim when memcg is dying To: Usama Arif Cc: linux-mm@kvack.org, yingfu.zhou@shopee.com, Jiayuan Chen , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Qi Zheng , Lorenzo Stoakes , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260624135839.2596358-1-usama.arif@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Jiayuan Chen In-Reply-To: <20260624135839.2596358-1-usama.arif@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 6/24/26 9:58 PM, Usama Arif wrote: > On Tue, 23 Jun 2026 14:27:56 +0800 Jiayuan Chen wrote: > >> From: Jiayuan Chen >> >> Proactive reclaim via memory.reclaim can run for a long time - swap I/O >> or thrashing again dominating the latency - and delays cgroup removal in >> the same way. >> >> Mitigate this by stopping the reclaim once memcg_is_dying(). >> >> Reported-by: Zhou Yingfu >> Cc: Jiayuan Chen >> Signed-off-by: Jiayuan Chen >> --- >> mm/vmscan.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index 8190c4abec84..1162b7f76655 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -7922,6 +7922,9 @@ int user_proactive_reclaim(char *buf, >> if (memcg) { >> unsigned int reclaim_options; >> >> + if (memcg_is_dying(memcg)) >> + break; >> + > This exits the reclaim loop with nr_reclaimed < nr_to_reclaim, but the > function then returns 0 and memory_reclaim() reports a successful write. > I think you want to return -EAGAIN here? You are right that an error should be returned instead of 0. But since memcg is being deleted, I'm reconsidering the appropriateerror code. -EAGAIN, -ENOENT, -EINTR are possible candidates