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: <YbPIKW/yCo5lErwE@hirez.programming.kicks-ass.net>
Date:   Fri, 10 Dec 2021 22:35:37 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Hellwig <hch@...radead.org>,
        Manjong Lee <mj0123.lee@...sung.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, seunghwan.hyun@...sung.com,
        sookwan7.kim@...sung.com, nanich.lee@...sung.com,
        yt0928.kim@...sung.com, junho89.kim@...sung.com,
        jisoo2146.oh@...sung.com
Subject: Re: [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister

On Fri, Oct 22, 2021 at 03:58:13AM +0100, Matthew Wilcox wrote:
> On Thu, Oct 21, 2021 at 07:45:30PM -0700, Andrew Morton wrote:
> > On Thu, 21 Oct 2021 13:01:30 +0100 Matthew Wilcox <willy@...radead.org> wrote:
> > 
> > > On Thu, Oct 21, 2021 at 04:16:52AM -0700, Christoph Hellwig wrote:
> > > > On Fri, Oct 22, 2021 at 01:19:43AM +0900, Manjong Lee wrote:
> > > > > Because when sdcard is removed, bdi_min_ratio value will remain.
> > > > > Currently, the only way to reset bdi_ min_ratio is to reboot.
> > > > 
> > > > But bdis that are unregistered are never re-registered.  What is
> > > > the problem you're trying to solve?
> > > 
> > > The global bdi_min_ratio needs to be adjusted.  See
> > > bdi_set_min_ratio() in mm/page-writeback.c.
> > 
> > I added cc:stable to this and tweaked the comment & coding style a bit:
> 
> Definitely improvements on that front.
> 
> I don't know the BDI code particularly well, and the implementation of
> bdi_set_min_ratio() confuses me, so I can't say whether the original
> patch is clearly correct or not.

Looks like something I might've written :-)

I'm thinking the part:

	min_ratio -= bdi->min_ratio;
	if (bdi_min_ratio + min_ratio < 100) {
		bdi_min_ratio += min_ratio;
		bdi->min_ratio += min_ratio;
	}

is what confuses? particularly when min_ratio < bdi->min_ratio?

Anyway, two cases: bdi->min_ratio < min_ratio and bdi->min_ratio >
min_ratio, let's do both with 0 and 10.

bdi->min_ratio = 0, min_ratio = 10 gives us:

min_ratio -= bdi->min_ratio;		// 10 -= 0 == 10
if (bdi_min_ratio + min_ratio < 100) {	// x + 10 < 100
	bdi_min_ratio += min_ratio;	// x += 10
	bdi->min_ratio += min_ratio	// 0 += 10 == 10
}

The other way around, bdi->min_raito = 10, min_ratio = 0:

min_ratio -= bdi->min_ratio;		// 0 -= 10 == -10
if (bdi_min_ratio + min_ratio < 100) {	// x + -10 < 100
	bdi_min_ratio += min_ratio;	// x += -10
	bdi->min_ratio += min_ratio;	// 10 += -10 == 0
}

Makes sense?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ