lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240429034738.138609-5-shikemeng@huaweicloud.com>
Date: Mon, 29 Apr 2024 11:47:32 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: willy@...radead.org,
	akpm@...ux-foundation.org,
	jack@...e.cz,
	tj@...nel.org
Cc: linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 04/10] writeback use [global/wb]_domain_dirty_avail helper in cgwb_calc_thresh

Use [global/wb]_domain_dirty_avail helper in cgwb_calc_thresh to remove
repeated code.

Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
 mm/page-writeback.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 28a29180fc9f..a1d48e8387ed 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -934,16 +934,9 @@ unsigned long cgwb_calc_thresh(struct bdi_writeback *wb)
 {
 	struct dirty_throttle_control gdtc = { GDTC_INIT_NO_WB };
 	struct dirty_throttle_control mdtc = { MDTC_INIT(wb, &gdtc) };
-	unsigned long filepages = 0, headroom = 0, writeback = 0;
-
-	gdtc.avail = global_dirtyable_memory();
-	gdtc.dirty = global_node_page_state(NR_FILE_DIRTY) +
-		     global_node_page_state(NR_WRITEBACK);
 
-	mem_cgroup_wb_stats(wb, &filepages, &headroom,
-			    &mdtc.dirty, &writeback);
-	mdtc.dirty += writeback;
-	mdtc_calc_avail(&mdtc, filepages, headroom);
+	global_domain_dirty_avail(&gdtc, false);
+	wb_domain_dirty_avail(&mdtc, false);
 	domain_dirty_limits(&mdtc);
 
 	return __wb_calc_thresh(&mdtc, mdtc.thresh);
-- 
2.30.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ