From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42F5C21D590 for ; Mon, 27 Apr 2026 18:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777314147; cv=none; b=Ss/FJybgmMfKi4BITv6oxLVjZS+euVyaV7P4s1nsVWImF/Ut0lsNHGwuiP7Id4hhk8iPM/HV6pJbjyec1goJXbbpXY7Hf1iC8etY455Ll3DZt5Mu/MYqyc+Sxq+QV1lQFFN0Q/pa71PN/pS+ZxU/hxwOR8cYOiAd6porJAjL8G4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777314147; c=relaxed/simple; bh=ZWEoXgUS/wfNTmJKMH464dC01fv+yC02z9MlWK6fI5s=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=kNYbG5zgUPuHa4fddjWX8+krXHpKyGpCMCK4l7TymyuHxiTfZ93HgPHFoyepRS2avlHLyOrQSAe/8fNdSzMhWNCn1Tf0v7uj2Tq2YmUdF6Izr7s4vj+KrHdjVVv/4dH5pFQxftOj7P8OgJ6q+2HcQ3nNZkOMxF5Z7ubn2glqzWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=HSSOZjVb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="HSSOZjVb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EF49C19425; Mon, 27 Apr 2026 18:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777314146; bh=ZWEoXgUS/wfNTmJKMH464dC01fv+yC02z9MlWK6fI5s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HSSOZjVbACaTHAh1yK4L/NRqT1Na3DhszOVcUjsGdS1txy2IfGGyWfcEH4aup3OrZ aHSpCZmwug1e/IqhatX+a4f160We6zSXtvAij3J1eSSI4viMlBpuODrp01fQY/JHp9 0ea7VaLV+X+SXsEf9GwKpAu6UQDLi9TZe2zgfaGA= Date: Mon, 27 Apr 2026 11:22:25 -0700 From: Andrew Morton To: kasong@tencent.com Cc: Kairui Song via B4 Relay , linux-mm@kvack.org, Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Shakeel Butt , 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 00/15] mm/mglru: improve reclaim loop and dirty folio handling Message-Id: <20260427112225.3f752a385f58bd7dfddfaa25@linux-foundation.org> In-Reply-To: <20260428-mglru-reclaim-v7-0-02fabb92dc43@tencent.com> References: <20260428-mglru-reclaim-v7-0-02fabb92dc43@tencent.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 28 Apr 2026 02:06:51 +0800 Kairui Song via B4 Relay wrote: > From: Kairui Song > > This series cleans up and slightly improves MGLRU's reclaim loop and > dirty writeback handling. As a result, we can see an up to ~30% increase > in some workloads like MongoDB with YCSB and a huge decrease in file > refault, no swap involved. Other common benchmarks have no regression, > and LOC is reduced, with less unexpected OOM, too. Thanks, I've updated mm.git's mm-new branch to this version. > Changes in v7: > - Fix swappiness not being effective with a standalone fix patch > from Barry Song. It's OK to be a standalone fix since that is not a > major bug but an unexpected behavior change, and shouldn't effect any > bisecting. I slightly adjusted the commit message as the subjcect is too > long and getting truncated for mail: > https://lore.kernel.org/linux-mm/20260425205759.1701-1-baohua@kernel.org/ > - Remove the min limit for calculating nr_to_scan: > https://lore.kernel.org/linux-mm/aet1hd9DfRH4aSOO@KASONG-MC4/ > Instead just revert to V1: > https://sashiko.dev/#/message/20260318-mglru-reclaim-v1-3-2c46f9eb0508%40tencent.com > Everyone was fine with that, the min limit in later version was > introduced to cover sashiko's review on V1, but now think again, that's > actually not a bug and instead could be beneficial. This min > check doesn't always make sense and there isn't any practical issue observed. > - Retest still looking very good in every case. Here's how v7 altered mm.git. (Looks small - did I mess this up?) --- a/mm/vmscan.c~b +++ a/mm/vmscan.c @@ -4788,8 +4788,13 @@ static int isolate_folios(unsigned long *isolate_scanned = scanned; break; } - - type = !type; + /* + * If scanned > 0 and isolated == 0, avoid falling back to the + * other type, as this type remains sufficient. Falling back + * too readily can disrupt the positive_ctrl_err() bias. + */ + if (!scanned) + type = !type; } return total_scanned; @@ -4909,18 +4914,14 @@ static long get_nr_to_scan(struct lruvec unsigned long nr_to_scan, evictable; evictable = lruvec_evictable_size(lruvec, swappiness); - nr_to_scan = evictable; /* try to scrape all its memory if this memcg was deleted */ if (!mem_cgroup_online(memcg)) - return nr_to_scan; + return evictable; - nr_to_scan = apply_proportional_protection(memcg, sc, nr_to_scan); + nr_to_scan = apply_proportional_protection(memcg, sc, evictable); nr_to_scan >>= sc->priority; - if (!nr_to_scan && sc->priority < DEF_PRIORITY) - nr_to_scan = min(evictable, SWAP_CLUSTER_MAX); - return nr_to_scan; } _