From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 F3C322F25F5 for ; Wed, 1 Apr 2026 23:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775086645; cv=none; b=VsSvgHDOTtykyVYXDH1OW9+NMEllZYMdGaP8ny2snFPUeyxGhB4OgLZTSCLERyPthWVDRCLjNBOTp2opj/qH2OsTUyzoFqDgnYJRoNIaAr4ONHcTDKmzvCA/bMgcY6IVzDs5/kVSc2+4Sm7wwqdSSGOIzhgkvs7vgo+2OBOzXdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775086645; c=relaxed/simple; bh=8KUhwP2RyonZoGnCJGf1idYCHBzEKCF3CdfZu/FMVwo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PvKRSeb884Me5Kq2mi9wG5LIbIBcTA2wPoKDPxB73k6tvlnG9GOyBVMDVmWm7U2HEyO/KaRX4GYtRcZ31tpTn4M/ul3Li25knHLIKzwz3TB9MnaaDz+K8L9ipIP4LEPHu/rTHaqBR9YOcY8tJn4XFwzEtxWQUbHKzxx2z1ij9M8= 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=gH4y/ZCm; arc=none smtp.client-ip=91.218.175.173 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="gH4y/ZCm" Date: Wed, 1 Apr 2026 16:37:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775086640; 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=hY4tcz23n34pDy42gZbXUJKJX56cUVlfL/AJg7+tTAs=; b=gH4y/ZCmOpRFp1sW9gqJkOJuncCdsM9nUh3FN3xzZ54WdeMX81tuHPD33vW3I63wpt+2Qr QjsXI0f5Blr0FVcRmLjzCq7fG2ut1aAjCvc9b4VrI5u1Mjq38N0Lz/HroNn1z2kZ/ed8MM bpO1oP5AW+5yooMvWt6ZCwn+fu7vVf0= 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 , Qi Zheng , Lorenzo Stoakes , Barry Song , David Stevens , Chen Ridong , Leno Hou , Yafang Shao , Yu Zhao , Zicheng Wang , Kalesh Singh , Suren Baghdasaryan , Chris Li , Vernon Yang , linux-kernel@vger.kernel.org, Qi Zheng , Baolin Wang Subject: Re: [PATCH v2 08/12] mm/mglru: simplify and improve dirty writeback handling Message-ID: References: <20260329-mglru-reclaim-v2-0-b53a3678513c@tencent.com> <20260329-mglru-reclaim-v2-8-b53a3678513c@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: <20260329-mglru-reclaim-v2-8-b53a3678513c@tencent.com> X-Migadu-Flow: FLOW_OUT On Sun, Mar 29, 2026 at 03:52:34AM +0800, Kairui Song via B4 Relay wrote: > From: Kairui Song > > The current handling of dirty writeback folios is not working well for > file page heavy workloads: Dirty folios are protected and move to next > gen upon isolation of getting throttled or reactivation upon pageout > (shrink_folio_list). > > This might help to reduce the LRU lock contention slightly, but as a > result, the ping-pong effect of folios between head and tail of last two > gens is serious as the shrinker will run into protected dirty writeback > folios more frequently compared to activation. The dirty flush wakeup > condition is also much more passive compared to active/inactive LRU. > Active / inactve LRU wakes the flusher if one batch of folios passed to > shrink_folio_list is unevictable due to under writeback, but MGLRU > instead has to check this after the whole reclaim loop is done, and then > count the isolation protection number compared to the total reclaim > number. I was just ranting about this on Baolin's patch and thanks for unifying them. > > And we previously saw OOM problems with it, too, which were fixed but > still not perfect [1]. > > So instead, just drop the special handling for dirty writeback, just > re-activate it like active / inactive LRU. And also move the dirty flush > wake up check right after shrink_folio_list. This should improve both > throttling and performance. Please divide this patch into two separate ones. One for moving the flusher waker (& v1 throttling) within evict_folios() and second the above heuristic of dirty writeback.