From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-108.mta0.migadu.com [91.218.175.108]) (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 5C51935201B for ; Fri, 21 Aug 2026 01:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787276723; cv=none; b=MM8BcZCwzqCmbip+b0MZQ0ohXsjw/9P0O+43s4yKBZZxTYHJeWpe367Xqc9UOPhfU09L013kwTGGnQvMMTWEPuTRAb0lDaTQeP4jefSJy4uvgcu0kyHA1pSXe2pkSDf6h+z01I7I4Fq4VlDSQnM9Ek6haxgv4SI9azeZjQeIFOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787276723; c=relaxed/simple; bh=Gb3gKqWWZhzHZch1lV86VPNeY80SBN6K83Ep6tDE+RI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G3onKe5Tl9VahFDKKAPZc7k1cL012kA4Rs7pVUccBtwARn01owvZn4Xdr8N20SVvf8KO/wR8Ae5wMlGPkX3aitRt9QgZFdqsEaNXZMCpsHnYzMfUvnAH7OISKool+ErvWXida6BKbe6KSOPRxD+WIdgqzt2TJaW6nZOf+XHRR+s= 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=VgbusWlB; arc=none smtp.client-ip=91.218.175.108 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="VgbusWlB" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=Gb3gKqWWZhzHZch1lV86VPNeY80SBN6K83Ep6tDE+RI=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787276717; v=1; x=1787881517; b=VgbusWlB0oQShrZFLLvnKOXvI8GbomwedlgegqoQI96mA3dWPqFpmScapGVoSSwZn33O7BLo cZKbZN7YU4wGrkSw5eo+tQX7owDuhg830c1mwdbI07KG/W4+yWWkT2X2z1ncLBG6czW0nCrkdlx I0LBG97FMRIq5Z1wouJNywTQ= X-Envelope-To: linux-kernel@vger.kernel.org Received: from [10.63.107.123] (14.29.108.92) by smtp.migadu.com with ESMTPS id 608958cb15c913ce; Fri, 21 Aug 2026 01:45:17 +0000 X-Mizu-Trace-ID: 608958cb15c913ce X-Migadu-Flow: FLOW_OUT Message-ID: <4838e4ff-e982-4347-9972-741e08dd1bd0@linux.dev> Date: Fri, 21 Aug 2026 09:45:10 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] mm/mglru: retry the same type once if isolation fails due to races To: "Barry Song (Xiaomi)" , akpm@linux-foundation.org, linux-mm@kvack.org Cc: axelrasmussen@google.com, baolin.wang@linux.alibaba.com, baoquan.he@linux.dev, chenridong@xiaomi.com, david@kernel.org, hannes@cmpxchg.org, kasong@tencent.com, lianux.mm@gmail.com, linux-kernel@vger.kernel.org, ljs@kernel.org, lyugaofei@xiaomi.com, mhocko@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, stevensd@chromium.org, wangzicheng@honor.com, weixugc@google.com, yuanchu@google.com References: <20260820045603.68809-1-baohua@kernel.org> <20260820045603.68809-4-baohua@kernel.org> From: Ridong Chen In-Reply-To: <20260820045603.68809-4-baohua@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/20/2026 12:56 PM, Barry Song (Xiaomi) wrote: > If we are not exhausted (i.e., there are still folios in the > reclaimable generations) but fail to isolate any folios due to > promotions, protections, or races, retry once more to avoid going > through the outer loop again. > > Signed-off-by: Barry Song (Xiaomi) > --- > mm/vmscan.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 1f2e574b0061..1f302386d8ab 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4862,7 +4862,7 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec, > bool type_fallback_allowed = !is_single_type_reclaim(swappiness); > int type = get_type_to_scan(lruvec, swappiness); > int total_scanned = 0, scanned, tier; > - bool exhausted; > + bool exhausted, tried = false; > > retry: > tier = get_tier_idx(lruvec, type); > @@ -4885,6 +4885,14 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec, > type_fallback_allowed = false; > goto retry; > } > + /* > + * We are not exhausted, but failed to isolate any folios due to > + * promotions, protections, or races. Retry once to avoid a larger loop. > + */ > + if (!exhausted && !tried) { > + tried = true; > + goto retry; > + } > > return total_scanned; > } LGTM. Reviewed-by: Ridong Chen -- Best regards Ridong