Message ID | 20240429034738.138609-6-shikemeng@huaweicloud.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add helper functions to remove repeated code and | expand |
On Mon, Apr 29, 2024 at 11:47:33AM +0800, Kemeng Shi wrote: > Call domain_dirty_avail in balance_dirty_pages to remove repeated code. > This is also a preparation to factor out repeated code calculating > dirty limits in balance_dirty_pages. Ditto, probably better to roll up into the patch which factors out domain_dirty_avail(). Thanks.
on 5/2/2024 12:57 AM, Tejun Heo wrote: > On Mon, Apr 29, 2024 at 11:47:33AM +0800, Kemeng Shi wrote: >> Call domain_dirty_avail in balance_dirty_pages to remove repeated code. >> This is also a preparation to factor out repeated code calculating >> dirty limits in balance_dirty_pages. > > Ditto, probably better to roll up into the patch which factors out > domain_dirty_avail(). > Sure, will do it in next version. Thanks. > Thanks. >
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a1d48e8387ed..c41db87f4e98 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1747,9 +1747,8 @@ static int balance_dirty_pages(struct bdi_writeback *wb, unsigned long m_bg_thresh = 0; nr_dirty = global_node_page_state(NR_FILE_DIRTY); - gdtc->avail = global_dirtyable_memory(); - gdtc->dirty = nr_dirty + global_node_page_state(NR_WRITEBACK); + domain_dirty_avail(gdtc, false); domain_dirty_limits(gdtc); if (unlikely(strictlimit)) { @@ -1765,17 +1764,11 @@ static int balance_dirty_pages(struct bdi_writeback *wb, } if (mdtc) { - unsigned long filepages, headroom, writeback; - /* * If @wb belongs to !root memcg, repeat the same * basic calculations for the memcg domain. */ - mem_cgroup_wb_stats(wb, &filepages, &headroom, - &mdtc->dirty, &writeback); - mdtc->dirty += writeback; - mdtc_calc_avail(mdtc, filepages, headroom); - + domain_dirty_avail(mdtc, false); domain_dirty_limits(mdtc); if (unlikely(strictlimit)) {
Call domain_dirty_avail in balance_dirty_pages to remove repeated code. This is also a preparation to factor out repeated code calculating dirty limits in balance_dirty_pages. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> --- mm/page-writeback.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)