From: Peter Zijlstra <peterz@infradead.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Manjong Lee <mj0123.lee@samsung.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
seunghwan.hyun@samsung.com, sookwan7.kim@samsung.com,
nanich.lee@samsung.com, yt0928.kim@samsung.com,
junho89.kim@samsung.com, jisoo2146.oh@samsung.com
Subject: Re: [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister
Date: Fri, 10 Dec 2021 22:35:37 +0100 [thread overview]
Message-ID: <YbPIKW/yCo5lErwE@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YXIoxefk8UDDCt0M@casper.infradead.org>
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@infradead.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?
next prev parent reply other threads:[~2021-12-10 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20211021072307epcas1p4aa4388c13e71a66e3e1d5f7ee68b5a7f@epcas1p4.samsung.com>
2021-10-21 16:19 ` [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister Manjong Lee
2021-10-21 11:16 ` Christoph Hellwig
2021-10-21 12:01 ` Matthew Wilcox
2021-10-22 2:45 ` Andrew Morton
2021-10-22 2:58 ` Matthew Wilcox
2021-10-22 13:39 ` Manjong Lee
2021-12-10 21:35 ` Peter Zijlstra [this message]
2021-12-10 21:36 ` Peter Zijlstra
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=YbPIKW/yCo5lErwE@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=jisoo2146.oh@samsung.com \
--cc=junho89.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mj0123.lee@samsung.com \
--cc=nanich.lee@samsung.com \
--cc=seunghwan.hyun@samsung.com \
--cc=sookwan7.kim@samsung.com \
--cc=willy@infradead.org \
--cc=yt0928.kim@samsung.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.