Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Jan Kara <jack@suse.cz>,
	willy@infradead.org, akpm@linux-foundation.org, tj@kernel.org,
	hcochran@kernelspring.com, axboe@kernel.dk, mszeredi@redhat.com,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] mm: correct calculation of wb's bg_thresh in cgroup domain
Date: Tue, 7 May 2024 15:28:51 +0200	[thread overview]
Message-ID: <20240507132851.rck2mc4sywaav67f@quack3> (raw)
In-Reply-To: <12bf104e-aeac-67a5-6e5a-bc7bdbfe4d79@huaweicloud.com>

On Tue 07-05-24 09:16:39, Kemeng Shi wrote:
> 
> Hi Jan,
> on 5/3/2024 5:30 PM, Jan Kara wrote:
> > On Thu 25-04-24 21:17:22, Kemeng Shi wrote:
> >> The wb_calc_thresh is supposed to calculate wb's share of bg_thresh in
> >> global domain. To calculate wb's share of bg_thresh in cgroup domain,
> >> it's more reasonable to use __wb_calc_thresh in which way we calculate
> >> dirty_thresh in cgroup domain in balance_dirty_pages().
> >>
> >> Consider following domain hierarchy:
> >>                 global domain (> 20G)
> >>                 /                 \
> >>         cgroup domain1(10G)     cgroup domain2(10G)
> >>                 |                 |
> >> bdi            wb1               wb2
> >> Assume wb1 and wb2 has the same bandwidth.
> >> We have global domain bg_thresh > 2G, cgroup domain bg_thresh 1G.
> >> Then we have:
> >> wb's thresh in global domain = 2G * (wb bandwidth) / (system bandwidth)
> >> = 2G * 1/2 = 1G
> >> wb's thresh in cgroup domain = 1G * (wb bandwidth) / (system bandwidth)
> >> = 1G * 1/2 = 0.5G
> >> At last, wb1 and wb2 will be limited at 0.5G, the system will be limited
> >> at 1G which is less than global domain bg_thresh 2G.
> > 
> > This was a bit hard to understand for me so I'd rephrase it as:
> > 
> > wb_calc_thresh() is calculating wb's share of bg_thresh in the global
> > domain. However in case of cgroup writeback this is not the right thing to
> > do. Consider the following domain hierarchy:
> > 
> >                 global domain (> 20G)
> >                 /                 \
> >           cgroup1 (10G)     cgroup2 (10G)
> >                 |                 |
> > bdi            wb1               wb2
> > 
> > and assume wb1 and wb2 have the same bandwidth and the background threshold
> > is set at 10%. The bg_thresh of cgroup1 and cgroup2 is going to be 1G. Now
> > because wb_calc_thresh(mdtc->wb, mdtc->bg_thresh) calculates per-wb
> > threshold in the global domain as (wb bandwidth) / (domain bandwidth) it
> > returns bg_thresh for wb1 as 0.5G although it has nobody to compete against
> > in cgroup1.
> > 
> > Fix the problem by calculating wb's share of bg_thresh in the cgroup
> > domain.
> Thanks for improving the changelog. As this was merged into -mm and
> mm-unstable tree, I'm not sure if a new patch is needed. If there is
> anything I should do, please let me konw. Thanks.

No need to do anything here. Andrew has picked up these updates.

									Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR


  reply	other threads:[~2024-05-07 13:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 13:17 [PATCH v2 0/4] Fix and cleanups to page-writeback Kemeng Shi
2024-04-25 13:17 ` [PATCH v2 1/4] mm: enable __wb_calc_thresh to calculate dirty background threshold Kemeng Shi
2024-05-03  9:11   ` Jan Kara
2024-04-25 13:17 ` [PATCH v2 2/4] mm: correct calculation of wb's bg_thresh in cgroup domain Kemeng Shi
2024-05-03  9:30   ` Jan Kara
2024-05-07  1:16     ` Kemeng Shi
2024-05-07 13:28       ` Jan Kara [this message]
2024-04-25 13:17 ` [PATCH v2 3/4] mm: call __wb_calc_thresh instead of wb_calc_thresh in wb_over_bg_thresh Kemeng Shi
2024-05-03  9:31   ` Jan Kara
2024-04-25 13:17 ` [PATCH v2 4/4] mm: remove stale comment __folio_mark_dirty Kemeng Shi
2024-05-03  9:31   ` Jan Kara
2024-05-01 16:16 ` [PATCH v2 0/4] Fix and cleanups to page-writeback Tejun Heo
2024-05-06  1:25   ` Kemeng Shi

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=20240507132851.rck2mc4sywaav67f@quack3 \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hcochran@kernelspring.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mszeredi@redhat.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=tj@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).