linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: alexjlzheng@gmail.com
To: willy@infradead.org, akpm@linux-foundation.org,
	andrea@betterlinux.com, fengguang.wu@intel.com
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, mengensun@tencent.com,
	Jinliang Zheng <alexjlzheng@tencent.com>,
	stable@vger.kernel.org
Subject: [PATCH v2] mm: fix ratelimit_pages update error in dirty_ratio_handler()
Date: Tue, 15 Apr 2025 17:02:32 +0800	[thread overview]
Message-ID: <20250415090232.7544-1-alexjlzheng@tencent.com> (raw)

From: Jinliang Zheng <alexjlzheng@tencent.com>

In the dirty_ratio_handler() function, vm_dirty_bytes must be set to
zero before calling writeback_set_ratelimit(), as global_dirty_limits()
always prioritizes the value of vm_dirty_bytes.

That causes ratelimit_pages to still use the value calculated based on
vm_dirty_bytes, which is wrong now.

Fixes: 9d823e8f6b1b ("writeback: per task dirty rate limit")
Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Reviewed-by: MengEn Sun <mengensun@tencent.com>
Cc: stable@vger.kernel.org
---
Changelog:
v2: A more detailed description
v1: https://lore.kernel.org/linux-fsdevel/20250415083542.6946-1-alexjlzheng@tencent.com/T/#u
---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index c81624bc3969..20e1d76f1eba 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -520,8 +520,8 @@ static int dirty_ratio_handler(const struct ctl_table *table, int write, void *b
 
 	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
 	if (ret == 0 && write && vm_dirty_ratio != old_ratio) {
-		writeback_set_ratelimit();
 		vm_dirty_bytes = 0;
+		writeback_set_ratelimit();
 	}
 	return ret;
 }
-- 
2.49.0



             reply	other threads:[~2025-04-15  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  9:02 alexjlzheng [this message]
2025-04-16  1:58 ` Andrew Morton
2025-04-16  4:31   ` Jinliang Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415090232.7544-1-alexjlzheng@tencent.com \
    --to=alexjlzheng@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexjlzheng@tencent.com \
    --cc=andrea@betterlinux.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mengensun@tencent.com \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox