[PATCH 13/13] writeback: set the num of writeback contexts to number of online cpus

Kundan Kumar
2025-05-29T11:34:19Z

We create N number of writeback contexts, N = number of online cpus. The
inodes gets distributed across different writeback contexts, enabling
parallel writeback.

Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
mm/backing-dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index d416122e2914..55c07c9be4cd 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -1046,7 +1046,7 @@ int bdi_init(struct backing_dev_info *bdi)
bdi->min_ratio = 0;
bdi->max_ratio = 100 * BDI_RATIO_SCALE;
bdi->max_prop_frac = FPROP_FRAC_BASE;
- bdi->nr_wb_ctx = 1;
+ bdi->nr_wb_ctx = num_online_cpus();
bdi->wb_ctx_arr = kcalloc(bdi->nr_wb_ctx,
sizeof(struct bdi_writeback_ctx *),
GFP_KERNEL);
--
2.25.1