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 7C59CC433F5 for ; Wed, 27 Oct 2021 07:42:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D76A760E05 for ; Wed, 27 Oct 2021 07:42:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D76A760E05 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 20C05940008; Wed, 27 Oct 2021 03:42:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BA24940007; Wed, 27 Oct 2021 03:42:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A97E940008; Wed, 27 Oct 2021 03:42:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id EBA11940007 for ; Wed, 27 Oct 2021 03:42:11 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A4ED82BC06 for ; Wed, 27 Oct 2021 07:42:11 +0000 (UTC) X-FDA: 78741424062.36.B2576B1 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf15.hostedemail.com (Postfix) with ESMTP id 6D493D0000A1 for ; Wed, 27 Oct 2021 07:42:04 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 093C068AFE; Wed, 27 Oct 2021 09:42:08 +0200 (CEST) Date: Wed, 27 Oct 2021 09:42:07 +0200 From: Christoph Hellwig To: Jan Kara Cc: Christoph Hellwig , Andrew Morton , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 5/5] mm: simplify bdi refcounting Message-ID: <20211027074207.GA12793@lst.de> References: <20211021124441.668816-1-hch@lst.de> <20211021124441.668816-6-hch@lst.de> <20211022090203.GF1026@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211022090203.GF1026@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) X-Stat-Signature: 7aud9y1y9qj6e84tto6xro9mh7mfwok1 Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=none; spf=none (imf15.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6D493D0000A1 X-HE-Tag: 1635320524-777352 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 Fri, Oct 22, 2021 at 11:02:03AM +0200, Jan Kara wrote: > On Thu 21-10-21 14:44:41, Christoph Hellwig wrote: > > Move grabbing and releasing the bdi refcount out of the common > > wb_init/wb_exit helpers into code that is only used for the non-default > > memcg driven bdi_writeback structures. > > > > Signed-off-by: Christoph Hellwig > > Can we perhaps add a comment to struct bdi_writeback definition (or maybe > wb_init()?) mentioning that it holds a reference to 'bdi' if it is > bdi_writeback struct for a cgroup? I don't see it mentioned anywhere and > now that you've changed the code, it isn't that obvious from the code > either... Otherwise the patch looks good so feel free to add: Like this? diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 33207004cfded..a3d7dd1cc30a1 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -103,6 +103,9 @@ struct wb_completion { * change as blkcg is disabled and enabled higher up in the hierarchy, a wb * is tested for blkcg after lookup and removed from index on mismatch so * that a new wb for the combination can be created. + * + * Each bdi_writeback that is no embedded into the backing_dev_info must hold + * a reference to the parent backing_dev_info. See cgwb_create() for details. */ struct bdi_writeback { struct backing_dev_info *bdi; /* our parent bdi */