From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 BF3F827BF79 for ; Tue, 30 Jun 2026 01:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782783001; cv=none; b=ImSQ65i9qKLrdPJpHjmRE65KTNGGc4tAj5pZZ1PjM3wjpKBa/TEqBBVsmRerfEFKRW6lLu1TFDan5VS6VmjyOFQ83eSmUoZFLsiuk7fNIGjlcF86kPoeYr4FuiiO0zWECGXBaGmmszxLrRiQilqHtI1sthNxuSeE8RuuzT7ZwRM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782783001; c=relaxed/simple; bh=aFJldYyAlb1CdY3ktbD93x91fYqbwdvJA9Y1WTRy3Vo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bbE+Ls8iFWZFAqpl0mybGJ4dZx1FpPLJ2DpNCEHJ++8W1s1eEm5rIEws3yi1ntthZ5UaEyb38fjcswl5FTk/c0MX1ZKwW/3NbDmNRA7IrH/dNnsghMx7b+5L4Z9MuHtnfTZsuce1fUQ/+5dNqJY0B1kjqlg5GjJZaQYj3grBBhY= 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=LJ8Tyy/N; arc=none smtp.client-ip=91.218.175.172 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="LJ8Tyy/N" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782782989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v+SjXDyaIUskmylTeULQ7YpsBG7g1B+2e1JWTTH/oMw=; b=LJ8Tyy/NprEhJ1xWl5tZRepKEJ7Bf0iHIWyvd/DvQB/j8JXueF6A951huLjm2u2D+cVJRC q+dns6nOTW2bNzOJnTxthMxSXn4oLUUr7N1+ZD/bPOdGaufs0lY8JnEs6PwF54z8GiuLxQ J1zBx6IR2GIfBmmIcQp4B6FfUlWqpDE= From: Jiayuan Chen To: linux-mm@kvack.org Cc: jiayuan.chen@shopee.com, 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 Subject: [PATCH v2 3/4] memcg: bail out proactive reclaim when memcg is dying Date: Tue, 30 Jun 2026 09:29:03 +0800 Message-ID: <20260630012909.144372-4-jiayuan.chen@linux.dev> In-Reply-To: <20260630012909.144372-1-jiayuan.chen@linux.dev> References: <20260630012909.144372-1-jiayuan.chen@linux.dev> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 754c5f5d716a..091b609cf1b1 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7912,6 +7912,9 @@ int user_proactive_reclaim(char *buf, if (signal_pending(current)) return -EINTR; + if (memcg && memcg_is_dying(memcg)) + return -EAGAIN; + /* * This is the final attempt, drain percpu lru caches in the * hope of introducing more evictable pages. -- 2.43.0