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 BC7841EFFA1 for ; Thu, 2 Apr 2026 03:02:50 +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=1775098974; cv=none; b=SYX3q6ZEPg7uV8Yuf6kzMvKm/hFxhwDBw02Opc+0nIi6hlMTkRghqwkqZBF+3+/Hc9fHajEfoa8ZUgzhtzwK+CRsSICy0tUReTk5AhAu6x+y/y1nXJ68vBCX04pQ6s2OS4HWY811zecN4qjF5TOnKRM1l0sK9/2A2wIQvgvpDiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775098974; c=relaxed/simple; bh=HgEnJLGbPA8S5Og6mQLlxjs4JoUZCeYrWVIFFLYgR+M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ejvYNDK9Uw5a7qurdnxpwMiHmxCyBgs2mzmkQyAVvWBhzYmJMHosPEfdUna0rMwB+a18/aoLg4tTVLn7b/cu6tQGPXj2c/RldpGAr8LbLpc/OVjxz4lDBCcTD1hOnI7r3gSfu0Ug1WpbVvFiZ7cvBVV7ijvY5kyovxbqW3USvOY= 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=qAG3p++B; 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="qAG3p++B" Date: Wed, 1 Apr 2026 20:02:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775098968; 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: in-reply-to:in-reply-to:references:references; bh=+Bm/iZ2SZCt+AC99FFO20xgoljQ3GBYc4xpX0mliCyE=; b=qAG3p++Bsn93CJPXaIZuqnQ12F2PgI1xcdGvaWN9uz51Wg/uVQ+KMak2x006Ut5RGPdaEA 6rUxxQD1zapneZCktFQMnMPeqR6jhY599/Ohfe0J90Lup/dUWK7w6fyPdgaEjd6j2St2kH K0DDzCKAdWK3cGmrWYb3ayXGCBfAd/I= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: "zhaoyang.huang" Cc: Andrew Morton , Michal Hocko , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [PATCHv3] mm: remove '!root_reclaim' checking in should_abort_scan() Message-ID: References: <20260318011558.1696310-1-zhaoyang.huang@unisoc.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: <20260318011558.1696310-1-zhaoyang.huang@unisoc.com> X-Migadu-Flow: FLOW_OUT On Wed, Mar 18, 2026 at 09:15:58AM +0800, 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 Acked-by: Shakeel Butt