From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 54CB734DCE6 for ; Thu, 2 Apr 2026 02:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775098577; cv=none; b=L1qlPB6VpADqAlNUcDmLp/IDCRu1W7h5OwRMc8w+/qHmydhg/qbtioEN6CK7HlDQdNlACeiO3naKucyrL3D+hceCpSHRIwy480eGKB0JPVFm1eK8iLQg507jjAyHW8mHM29s8bsFFdGBO+9uFUVpoyRTYAyxHdz/X//InenRtm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775098577; c=relaxed/simple; bh=hgOZzXILt4FuUwF6fVhVLhJ+WpKyGpEr03OirrVNBOk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QOpClIebVmQNDs8gKz1tXMY2bpkFRHKMdbjmdjNuozqsxSrHjGRU4O8j661W8zE6iGCmNqQdiX5Y9FIBuLZkhf6Py6tpbuGynB+Qij3jcDJH+ezrnRqRIZmf2Sjh2ulGJ4t0Ut4XPs58X2sdBL8TN5CVH5oZzF34h/bDCU7KJmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MIw5Pa7y; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MIw5Pa7y" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2ab46931cf1so10692385ad.0 for ; Wed, 01 Apr 2026 19:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775098576; x=1775703376; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YxJh7vY7ymqstvenqv7CWmrOnBh2MKIFs8pONvqJB0Q=; b=MIw5Pa7y5oIrs89qOGa4BlCwGiRg2uYf36BWxJw+uN+4v+bQ1vEpev6pvFd5dvObNO w/3CHiotOQrQcvLkVmF1MR4T5ryEYyuHh0NkCkCehMXEuhmNLrrM8h4Wp5lItwlbiYPP sqdha5HKCxW4sYlNTuWr/ZWOk7kDDDoW0v6C6TO/zu0pwWtOilv260QyFzAGpc0LAA8t 0Dn5UPO5cD8GkHohEOMFHHHiB8CbmRpWjVm/oMW6XBH3viVImYS4+RTi6/lnTaR4FOet ZgGqpDtSOiK5Vz4ExgZJB2+TBxDQ7osNxuVsN4PSpbpjicCEr6EiVCREQ86vXJsoHya2 nw9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775098576; x=1775703376; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YxJh7vY7ymqstvenqv7CWmrOnBh2MKIFs8pONvqJB0Q=; b=AiKFSSLyNuihLpabE1+ItLeF8BQb1vkfefXArXYVYEFrDeJgzlbW8qv0K2k90ILd3J 9mn7ilV7mIQNAXxsuDAV2aNoVowS3zKZxIQrQKUuvCBecwf2TcEEfcIUOZAxnNHlNCw5 f/2gheHoz+qpTmvZvP4+oL9h+OCPojFAE7zUkWCAwvtracyoBwrfLBxSn8o4eecgdoWd g+2WR1rwMHIMMsmdj0tYC9q/P6+DQKFqgbIGnnJQ4iNhqMyWofdEJNcKaP9r5PMkhwue qsKyOyBLjhjNYRWfQ8yZOFyx0P6sojzTIkL8D2D0TrNkDCQdpncwPNNCkBRZeQJKIVMy 7ObQ== X-Forwarded-Encrypted: i=1; AJvYcCXW8rdVSJnpukuVziCWyNM64NiVrKgO36/qgJRXfzsGS8eKy/n2Jw8abIj8qoxns1T6zqPPqt9AyJRU4Qc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6e+3/3dXHvQjpc20gJQ0vsCUeTuJpBkvqeSoYvKHJQrqTjKkn QedaOJlpWHTYF5aMf0Plq7DXu+MFEtBV7e5VXC/P+3VHQHYwRfNS5jG6 X-Gm-Gg: ATEYQzxFN/+paHQk1FbBn9vdy4CHeBMO5KNTnO0Q1+U3TXFkBvSRsW0rWg7e2wae2dw AFoGtbXkUhSDoF6Gu50i9wUuE9X9x0EDTgLSPPIu8xu6JRYbIEQfHEivLCaEU4mE3L9oVLXTnjd 8wIz+l0MQZKtxe31kOZs/F2lodZiUXW11XCoA3eDccq+AnHKQbTdzCkOPXIyeHg4XqtAPRgY/3m wVdFQg1OkYIvRolB32kY2t3rwjcQebRY2Rvz9cfSWBG/XHqisae5SHzmDdhuZTNIWjs4XWWzek6 JZiLoCZ84+TJJWO+ZiqJO9euGiwErU7mW8tk8HCiCt43dYy6DDOQq4S5kvKlBQ4DKWo3DFCvFTy NIiFo3OTQEGiDxvCbl5IlqjMr1ren3n3/uCa6zqnaanf7tLOYuZfQMgTQJ4xhBFyJKwkeD8HGll b6s8VFNUyQ0RaivVkBB3GL1CsHuFPIBGlzTN9TxGHPpDH5VrghW6q0JhOoO7iZgdss1gmQ X-Received: by 2002:a17:902:e84d:b0:2b0:5a4c:726f with SMTP id d9443c01a7336-2b277e3745cmr7657965ad.15.1775098575594; Wed, 01 Apr 2026 19:56:15 -0700 (PDT) Received: from KASONG-MC4 ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b27478b84esm10880025ad.32.2026.04.01.19.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2026 19:56:15 -0700 (PDT) Date: Thu, 2 Apr 2026 10:56:07 +0800 From: Kairui Song To: Shakeel Butt Cc: kasong@tencent.com, 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 12/12] mm/vmscan: unify writeback reclaim statistic and throttling Message-ID: References: <20260329-mglru-reclaim-v2-0-b53a3678513c@tencent.com> <20260329-mglru-reclaim-v2-12-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: On Wed, Apr 01, 2026 at 07:39:03PM +0800, Shakeel Butt wrote: > On Sun, Mar 29, 2026 at 03:52:38AM +0800, Kairui Song via B4 Relay wrote: > > From: Kairui Song > > > > Currently MGLRU and non-MGLRU handle the reclaim statistic and > > writeback handling very differently, especially throttling. > > Basically MGLRU just ignored the throttling part. > > > > Let's just unify this part, use a helper to deduplicate the code > > so both setups will share the same behavior. Also remove the > > folio_clear_reclaim in isolate_folio which was actively invalidating > > the congestion control. PG_reclaim is now handled by shrink_folio_list, > > keeping it in isolate_folio is not helpful. > > > > Test using following reproducer using bash: > > > > echo "Setup a slow device using dm delay" > > dd if=/dev/zero of=/var/tmp/backing bs=1M count=2048 > > LOOP=$(losetup --show -f /var/tmp/backing) > > mkfs.ext4 -q $LOOP > > echo "0 $(blockdev --getsz $LOOP) delay $LOOP 0 0 $LOOP 0 1000" | \ > > dmsetup create slow_dev > > mkdir -p /mnt/slow && mount /dev/mapper/slow_dev /mnt/slow > > > > echo "Start writeback pressure" > > sync && echo 3 > /proc/sys/vm/drop_caches > > mkdir /sys/fs/cgroup/test_wb > > echo 128M > /sys/fs/cgroup/test_wb/memory.max > > (echo $BASHPID > /sys/fs/cgroup/test_wb/cgroup.procs && \ > > dd if=/dev/zero of=/mnt/slow/testfile bs=1M count=192) > > > > echo "Clean up" > > echo "0 $(blockdev --getsz $LOOP) error" | dmsetup load slow_dev > > dmsetup resume slow_dev > > umount -l /mnt/slow && sync > > dmsetup remove slow_dev > > > > Before this commit, `dd` will get OOM killed immediately if > > MGLRU is enabled. Classic LRU is fine. > > > > After this commit, congestion control is now effective and no more > > What do you mean by congestion control here? This particular case demostrated here is VMSCAN_THROTTLE_CONGESTED so I described it as "congestion control", may I'll just say throttling to avoid confusion, it's not limited to that. > > > spin on LRU or premature OOM. > > > > Stress test on other workloads also looking good. > > > > Suggested-by: Chen Ridong > > Signed-off-by: Kairui Song > > There is still differences for global and kswapd reclaim in the shrink_node() > like kswapd throttling and congestion state management and throttling. Any plan > to unify them? Of course. Let fix it step by step, this series is pretty long already. I originally plan to put this patch in a later series, but as Ridong pointed out leaving these counter updated but unused looks really ugly. And this fix is clean and easily to understand I think.