From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (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 F153A25A642 for ; Mon, 24 Aug 2026 07:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787556147; cv=none; b=Sx3XjUnNDXGRZUhFU3hbz/Ju/3cHXvyWEQqEsfYCJ4ZGWWWF7SC7zHw6u2pJncI18B2q2zDFTmFfQn9L07tIjzIjD+NCZnMtwp0X+2ydLjVxHV1lxQ8CcB0M9CEMUNsYq8V56mr3ImBGksTBHRh+mgP0PLz1dXLI54KBlGO0gsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787556147; c=relaxed/simple; bh=Lcbu/HwDOJVjAKcj45cvKYTt9BsMxV7MIA797YR1WAA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=u9PMd2ncDZA6QtiJE52X/xJipDaa0Q8jyvFOcMh4UnMNFVDX99PgDTTzACjbu9yS2AhoBdz81MaEfFI3wtBpD/6eGCQLloS/9Lel/JzHEceLyuLKe10IxFiVnaeI3uAmEWKU2eRwqngKEKumtUHeH4x6zWTLpO5fk/NAVnGTGuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=x8zqAZlX; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="x8zqAZlX" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1787556136; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=wpRmk6TT1hToBXTvKj7HZNsfvh/PfrqnzaVGpFG3TYI=; b=x8zqAZlXOGTQaZR9KpNigcKxbAPUKyAYYInB6azeboF3WpYfsgwCYHnocUE23F0apGuWGfSlW+6pNCAqBIhZVLjcZAVCzvx45omBayAhTaTbKTQ5ELEzUGb5CBL4GtB6YOph7HsL0fGrhKG2VpWIosALZuX8i79suJBVPwTzB5E= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0X9U07yk_1787556133; Received: from 30.74.144.121(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X9U07yk_1787556133 cluster:ay36) by smtp.aliyun-inc.com; Mon, 24 Aug 2026 15:22:14 +0800 Message-ID: <7e897a4e-2075-485a-8cc5-5bb928fba437@linux.alibaba.com> Date: Mon, 24 Aug 2026 15:22:13 +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 0/3] mm/mglru: clean up isolate_folios and scan_folios for readability and clarity To: "Barry Song (Xiaomi)" , akpm@linux-foundation.org, linux-mm@kvack.org Cc: axelrasmussen@google.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> From: Baolin Wang In-Reply-To: <20260820045603.68809-1-baohua@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/20/26 12:56 PM, Barry Song (Xiaomi) wrote: > This is a cleanup series split out from the MGLRU swappiness series [1], > with the cleanup changes separated to make them easier to review. > > Right now, isolate_folios() is quite difficult to follow: > > 1. It uses for_each_evictable_type(i, swappiness) to iterate over the > types, but i is not actually used as the type within the loop body. > > 2. It uses scanned == 0 to detect whether the current reclaim type is > exhausted, but this is not an accurate indication. > > 3. It has an internal retry when no folios can be isolated after scanning > some folios, but the retry is implemented in a way nobody can understand. > > This patchset makes these behaviors explicit and much easier to follow. > > Run kernel builds for several rounds in a 1 GB memcg and take the > average build time. The patchset shows almost no performance impact, > with a very small improvement that could simply be noise: Just FYI: I tested this patchset with a 3G memcg limit and a 10G zram device, running 'make -j32' to build kernel on my 32-core Arm machines, and got some performance improvement for ths sys time: w/o patch w/patch sys 1845s 1570s > w/o patch w/patch Delta > > real 109.149 108.990 -0.15% > sys 223.213 222.592 -0.28% > > pgscan_file 498,208 486,994 -2.25% > refault_file 262,696 254,688 -3.05% > > Thanks very much to Baolin and Lian for their previous reviews of the > original RFC patchset for this part. > > [1] https://lore.kernel.org/linux-mm/20260812121658.69965-1-baohua@kernel.org/ > > Barry Song (Xiaomi) (2): > mm/mglru: improve scan_folios() exhaustion detection > mm/mglru: retry the same type once if isolation fails due to races > > Ridong Chen (1): > mm/mglru: improve readability of isolate_folios() > > mm/vmscan.c | 78 ++++++++++++++++++++++++++++++++++++----------------- > 1 file changed, 54 insertions(+), 24 deletions(-) >