From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 676DD359A7C for ; Thu, 2 Apr 2026 03:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775101021; cv=none; b=Zc24W252xpVEJ30sqcObclAjz//SzuBdVMRzcFOkAhOnXZUYJORCwedHbLaUotoQ9ICPFeJcTVs6PihYJEqyWVlJHZd/Dv9HnihQqbRQPq77GSp+o7bzCl8Dy9+tTNjCwx5aviWxR3mwmaM68xDhKoy/JcMk3F6rGra7+0+4mO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775101021; c=relaxed/simple; bh=Ibqj0S8AAUYXTSHjG88minciYVErXYoXXtlufkaSBbw=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=YaJ8sv3Q/6ck/dvgfg35+UjlazrmI+hZOuqUiDx1YKrwi6Be6rOrosx4AllX0or3UfD46Ega/79DPSD1+axGny6MW14aG+72RCuKCqbDXOSmIY7Iytzuu7Tf+wGGd9pKSSXz1STYjJ7blvmaFOrHx3MpvQjLGeq4n339n7myL7k= 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=Rdrc7/V3; arc=none smtp.client-ip=91.218.175.184 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="Rdrc7/V3" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775101018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mZXLx++acdRu8DhYwcXdDHVnQSYFW5gNE6CjD6mZNEg=; b=Rdrc7/V3J+g4G1hURcA5Rg95YbY0ikwaqnfhQNX2QctZiT0N3cDnkq7PpgSO/xGMDkSRJG fSe9cqix0AR8oioa4p3gXDf0KAwzNszKbwrAROrWDhgUYUEkqHckloPm/shNd8O5dLreu/ dCFlB494z+E61qRfin3ezUdlWcp8kVU= Date: Thu, 2 Apr 2026 11:36:50 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCHv3] mm: remove '!root_reclaim' checking in should_abort_scan() To: "zhaoyang.huang" , Andrew Morton , Michal Hocko , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com References: <20260318011558.1696310-1-zhaoyang.huang@unisoc.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: <20260318011558.1696310-1-zhaoyang.huang@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 3/18/26 9:15 AM, zhaoyang.huang wrote: > From: Zhaoyang Huang > > Android systems usually use memory.reclaim interface to implement user > space memory management which expects that the requested reclaim target > and actually reclaimed amount memory are not diverging by too much. With > the current MGRLU implementation there is, however, no bail out when the > reclaim target is reached and this could lead to an excessive reclaim > that scales with the reclaim hierarchy size.For example, we can get a > nr_reclaimed=394/nr_to_reclaim=32 proactive reclaim under a common 1-N > cgroup hierarchy. > This defect arised from the goal of keeping fairness among memcgs that > is, for try_to_free_mem_cgroup_pages -> shrink_node_memcgs -> > shrink_lruvec -> lru_gen_shrink_lruvec -> try_to_shrink_lruvec, the > !root_reclaim(sc) check was there for reclaim fairness, which was > necessary before commit 'b82b530740b9' ("mm: vmscan: restore > incremental cgroup iteration") because the fairness depended on > attempted proportional reclaim from every memcg under the target > memcg. However after commit 'b82b530740b9' there is no longer a need > to visit every memcg to ensure fairness. Let's have try_to_shrink_lruvec > bail out when the nr_reclaimed achieved. > > Suggested-by: T.J.Mercier > Reviewed-by: T.J.Mercier > Signed-off-by: Zhaoyang Huang > --- > Patchv2,v3: update commit message > --- > --- > mm/vmscan.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 0fc9373e8251..10f1e7d716ca 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4839,10 +4839,6 @@ static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc) > int i; > enum zone_watermarks mark; > > - /* don't abort memcg reclaim to ensure fairness */ > - if (!root_reclaim(sc)) > - return false; > - > if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order))) > return true; > Make sense. Acked-by: Qi Zheng Thanks!