From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BDE4C433EF for ; Fri, 22 Oct 2021 02:45:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B1E706139F for ; Fri, 22 Oct 2021 02:45:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B1E706139F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4991B94000A; Thu, 21 Oct 2021 22:45:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 421E5900002; Thu, 21 Oct 2021 22:45:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EA6794000A; Thu, 21 Oct 2021 22:45:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 1E269900002 for ; Thu, 21 Oct 2021 22:45:34 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CC5E68249980 for ; Fri, 22 Oct 2021 02:45:33 +0000 (UTC) X-FDA: 78722532546.03.F8CA876 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id 2523950000AE for ; Fri, 22 Oct 2021 02:45:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 359E7613DA; Fri, 22 Oct 2021 02:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1634870732; bh=c6hUSwQF7luins0JK+w46yPAWdt0DouzfgIY/quVreE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kBL1C/uLaibJPDQVHUNkCX/Odyh8lgmtwfafHNGlEExbSFGDfeQL9pkiCb7ovUgDW MYcLDXcA4gJhfthx7s/aTLqoqbBZ7GhOjoTwU/y9RdGLG0VwcQftlxdSqndhbEaTHC vS4J5e1nu6uGTZClKN5joSGsMOut2CFQq92Q2USc= Date: Thu, 21 Oct 2021 19:45:30 -0700 From: Andrew Morton To: Matthew Wilcox Cc: Christoph Hellwig , Manjong Lee , 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 Message-Id: <20211021194530.1fabf4fa45cfe3bee6598484@linux-foundation.org> In-Reply-To: References: <20211021161942.5983-1-mj0123.lee@samsung.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2523950000AE X-Stat-Signature: um9azd1ph57x5hbwxankn3ck7gto7u8q Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="kBL1C/uL"; dmarc=none; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1634870730-707980 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 21 Oct 2021 13:01:30 +0100 Matthew Wilcox 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: --- a/mm/backing-dev.c~mm-bdi-initialize-bdi_min_ratio-when-bdi-unregister-fix +++ a/mm/backing-dev.c @@ -947,10 +947,12 @@ void bdi_unregister(struct backing_dev_i wb_shutdown(&bdi->wb); cgwb_bdi_unregister(bdi); - /* if min ratio doesn't 0, it has to set 0 before unregister */ - if (bdi->min_ratio) { + /* + * If this BDI's min ratio has been set, use bdi_set_min_ratio() to + * update the global bdi_min_ratio. + */ + if (bdi->min_ratio) bdi_set_min_ratio(bdi, 0); - } if (bdi->dev) { bdi_debug_unregister(bdi); _