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 32A1C39F18F for ; Fri, 29 May 2026 05:40:39 +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=1780033240; cv=none; b=b5O9gpq9QCar7uMck1izb44FaaTBg6PAnrpdc8cRTwew1F//GH3SOtxdcoypLHsTkr2JPuYCUgLaj99uoD3bBb1uF9AdZAbzEUCFUbU40YnDFmjhNAwxnVXw0RYexltuHsHrYscXQkr2l0DGTRUOIzsdi3Bfo9qAqMaYLnRaz60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780033240; c=relaxed/simple; bh=uHLI7Eg/Uk2u/hmCksWPC8ruE2pUp5X8JrxnOSb+f3c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tbuCkZvOKWR7yzqkiJIBfU5liRxOTK4cd/as06A7YlWmIgq1mOfq5QMIQwU75U58mhAwe1bOw981DdQCj+lTjJbDLc/IVEXo2hdSR2ubAicGtmBpCxJS/zeimZncubq85W6uXNSJCW01hbR5EEleyLWFQSmq8PeIs8fs86qlKSE= 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=UWlwYTRE; 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="UWlwYTRE" Date: Thu, 28 May 2026 22:40:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780033236; 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=I9k5Umt41qtvFiKFxTrVVX77y/ltXOpVZkfW/FZIPj0=; b=UWlwYTRE0/x6m/CR/SZfiXfbDUOpdJQibgneeaVq0GpBRdvCLHXbVkYGfnQdLAvVaasCYN aoHf7j4UFEqaBU9HWGZqYIB4P7KdKHf5AMQwmqlg8lfAv2TIQrNj6zwmwlWa3KHoRB6lJN 2jUNfe8SSNYF8Vz68ocFemd5tI6+AnA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: kasong@tencent.com Cc: linux-mm@kvack.org, Andrew Morton , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Barry Song , David Stevens , Chen Ridong , Leno Hou , Yafang Shao , Yu Zhao , Zicheng Wang , Baolin Wang , Kalesh Singh , Suren Baghdasaryan , Chris Li , Vernon Yang , linux-kernel@vger.kernel.org, Kairui Song , Qi Zheng Subject: Re: [PATCH v7 03/15] mm/mglru: relocate the LRU scan batch limit to callers Message-ID: References: <20260428-mglru-reclaim-v7-0-02fabb92dc43@tencent.com> <20260428-mglru-reclaim-v7-3-02fabb92dc43@tencent.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: <20260428-mglru-reclaim-v7-3-02fabb92dc43@tencent.com> X-Migadu-Flow: FLOW_OUT On Tue, Apr 28, 2026 at 02:06:54AM +0800, Kairui Song via B4 Relay wrote: > From: Kairui Song > > Same as active / inactive LRU, MGLRU isolates and scans folios in batches. > The batch split is done hidden deep in the helper, which makes the code > harder to follow. The helper's arguments are also confusing since callers > usually request more folios than the batch size, so the helper almost > never processes the full requested amount. > > Move the batch splitting into the top loop to make it cleaner, there > should be no behavior change. > > Reviewed-by: Axel Rasmussen > Reviewed-by: Baolin Wang > Reviewed-by: Barry Song > Reviewed-by: Chen Ridong > Signed-off-by: Kairui Song > --- > mm/vmscan.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 7f011ff4c478..a011733a6392 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4695,10 +4695,10 @@ static int scan_folios(unsigned long nr_to_scan, struct lruvec *lruvec, > int scanned = 0; > int isolated = 0; > int skipped = 0; > - int scan_batch = min(nr_to_scan, MAX_LRU_BATCH); > - int remaining = scan_batch; > + unsigned long remaining = nr_to_scan; > struct lru_gen_folio *lrugen = &lruvec->lrugen; > > + VM_WARN_ON_ONCE(nr_to_scan > MAX_LRU_BATCH); Do we really need a warning here? Also why are we limiting it to MAX_LRU_BATCH? For memcg/proactive reclaim, we can get larger number. What will break if we remove this limitation? Anyways, these questions are orthogonal to the patch, so: Acked-by: Shakeel Butt