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] [day] [month] [year] [list]
Message-ID: <20240507132851.rck2mc4sywaav67f@quack3>
Date: Tue, 7 May 2024 15:28:51 +0200
From: Jan Kara <jack@...e.cz>
To: Kemeng Shi <shikemeng@...weicloud.com>
Cc: Jan Kara <jack@...e.cz>, willy@...radead.org, akpm@...ux-foundation.org,
	tj@...nel.org, hcochran@...nelspring.com, axboe@...nel.dk,
	mszeredi@...hat.com, linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] mm: correct calculation of wb's bg_thresh in
 cgroup domain

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@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ