Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp929589pxb; Fri, 15 Oct 2021 20:30:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSvq/qIY/Kp0xwEkAuGqQXR7Yf4PONqolDYhPLlsbBH0J2+VQRNRnMMaduqV3uA3jf4rxh X-Received: by 2002:a17:906:2c57:: with SMTP id f23mr11455885ejh.474.1634355010591; Fri, 15 Oct 2021 20:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634355010; cv=none; d=google.com; s=arc-20160816; b=xC2SrBuBZYWBfh6sOk7C8Kl963tcPQevsb8GmjhzQu+lGMv8gBgZESQtEfo7I0P75k Cu5Q87ndU0csKerw2EEG5OCSJO7X31guYs0qBLbXNXdhaN7ZA3jcqlTSQWEG0OizzEix OygevPE4jiAO7Y06Ra3YIGlsKZvf6oWxDxmB5ROu2b1U0aUGRlDXMrX49nNki1HZQZS2 fnnoLUyWZwNilniCcuujewN6/mZRjJUixQG1cFuLeZqgGi2s3XP/hzYRmRVU3ptUAnXL IdJmA8VS+QwFYcpK25GXGnD/xCJK3tLSND9d1zzgkr94BJ9CQOPT8f83hSkGFqmYOH2M XsgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xLRSIGsUfzGiK6WuxdgtdmvcVSjUeO6E6oJeq4OnRs0=; b=oMs2RXKYcg0zCMnqbs6aS4z+ayjl2Po0DHeeM7a2/M2OL5IFc8EvypMk9/63/2GtrT Lkg6kk1OvWMqsxpUj8aYyrvclH+QvjsNQ/2llaPUwJeftS2Evjum55+1vGj3W1GxWSeX 0WEcbSws46KE1yFpve/7c07MfofcdWgPaYYJ3ROONrqLJT3ZziMFhIMgbeof1HUr4mDI xc80Ot01DyWl09Im9fdcaZ1gCRLSVBymGeaImqAsXOQOfBeJEZ+WyMuCdDmJLCYyR+Jb vQ5pbyVXCHEnAQnLFbCCu7boszjmh4cvM6fV4SxUWE5oT9795kka92qpUIXXx8wL5bnQ PHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=h2XBkXF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd15si15272402ejc.463.2021.10.15.20.29.47; Fri, 15 Oct 2021 20:30:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=h2XBkXF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239334AbhJONV3 (ORCPT + 99 others); Fri, 15 Oct 2021 09:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234701AbhJONV2 (ORCPT ); Fri, 15 Oct 2021 09:21:28 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481A9C061570 for ; Fri, 15 Oct 2021 06:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xLRSIGsUfzGiK6WuxdgtdmvcVSjUeO6E6oJeq4OnRs0=; b=h2XBkXF8LeeKfvMCtxOY2LWz1O PwtQgKj1fcUO67xpNiI+6qoPqGj81MgQN6fBwGiIf9OXLpvpxtRrL+yrjULODmqnQdoD+u4ksVtTE I+eBkEC7SLHAJ5vnIAVHNBeIFUr8jiqQG0J8a7OYwiqw7qGf66e0ouuEomqkSwOG7kTJYVdk+ox2t w3lQdFrNQWFxCSdGi4I5P02SOkYK4Fs8LjOjNpeymKBvPNomKkU4GwPxD3STaelLb1QA6vjiRe2XN eJLscyae/TmjoTp069tZiQ/rn+MMi0j64iKYP1uPN+69rcH2RobmXuwo38/euYO3cCLNcEhTBtekr 2FJIpibQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbN7G-007B1X-1j; Fri, 15 Oct 2021 13:19:18 +0000 Date: Fri, 15 Oct 2021 06:19:18 -0700 From: Christoph Hellwig To: Matthew Wilcox Cc: Zqiang , hch@infradead.org, akpm@linux-foundation.org, sunhao.th@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mikulas Patocka , Jens Axboe , Tejun Heo Subject: Re: [PATCH] mm: backing-dev: use kfree_rcu() instead of synchronize_rcu_expedited() Message-ID: References: <20211014082433.30733-1-qiang.zhang1211@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 15, 2021 at 01:35:56PM +0100, Matthew Wilcox wrote: > struct backing_dev_info { > u64 id; > - struct rb_node rb_node; /* keyed by ->id */ > + union { > + struct rb_node rb_node; /* keyed by ->id */ > + struct rcu_head rcu; > + }; > struct list_head bdi_list; > unsigned long ra_pages; /* max readahead in PAGE_SIZE units */ > unsigned long io_pages; /* max allowed IO size */ > > > Christoph, independent of the inode lifetime problem, this actually seems > like a good approach to take. I don't see why we should synchronize_rcu() > here? Adding Jens (original introducer of the synchronize_rcu()), Mikulas > (converted it to use _expedited) and Tejun (worked around a problem when > using _expedited). The kfree+rcu + your suggestion does seem like a good idea in general to me. But I'd still like to fix the actual bug being reported before optimizing the area in a way that papers over the bug.