From patchwork Fri Jun 23 17:07:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 112243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5942459vqr; Fri, 23 Jun 2023 10:48:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jui6BqkVh5W6chF5glzbIff5S8tlTGh3zG0TgWKldPq1tP2KxxBvdrg00C2aI5cKKN7Ta X-Received: by 2002:a05:6a00:23c2:b0:668:69fa:f791 with SMTP id g2-20020a056a0023c200b0066869faf791mr14219047pfc.3.1687542480764; Fri, 23 Jun 2023 10:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687542480; cv=none; d=google.com; s=arc-20160816; b=zumhAks6/hvu+jhjLE0hFHn4A0CEWsVp64s6LyDAIB/zO7WVj2dV3FMLVqbmT7p9Km aoBFnXKUi1K9zYWL3iCQCY35PfGnErLfd+hYdJRtWLYlMZD9xyLimEbHMNPIh2r7dymG adMXECDDcANawMWWnG+jebFzCg6n2fXO8Al1s3vlb0SH6ZiX+rWn95oxu4KTP4HQbkeW eTamyo4IR4nBAbDlJlOwDSpUIHomDBdYRn/G4Wl3hIQNpvqnZclqsbfqVnxt8pNPveHs hwWRZfq8WWGHssPVaacObRKou5K2OlF7gMC+FAq3XcUmrUIVypBQ7F0Cq/kaVu7E3epR CjTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=02timQVtu6aTaDZlo3R3D4w+fsAbkYRbfC53CEOsKBw=; b=Wc62HrNmDGMYEDQRvETl2UY0t02dflnsU4I2OVElWoojHOvtm2C5Pe4nA0bhFUnpnz jnGVDHM5ihtz1hCNfc7m9GR/qr/DsjX6ahdQP9USDBeZizTxQF8PjEl7BMZPzxNjvZnX PzqZ9RmPw7MN68smwU/icwHjfDSw2zMtiwDJKv5A4gQ/skNgAzKi4e8axdeerXYcBvnd JLSD1rEL9IbQZWhn7xCeBsp80T/jd+HEtmDbl42Ug7ABP3CnRoyzDPzn40bcqhOZ9ogh JEghH96ApAVeuCXqud9abyVvkt2n/O/OuvfkLgwbMpRyHb0vTC5vF5++AQveNOjKaPqq mgkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e5lTG91l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a636908000000b0053011490008si2064926pgc.885.2023.06.23.10.47.47; Fri, 23 Jun 2023 10:48:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e5lTG91l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231841AbjFWRIZ (ORCPT + 99 others); Fri, 23 Jun 2023 13:08:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjFWRID (ORCPT ); Fri, 23 Jun 2023 13:08:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18A3F30D1 for ; Fri, 23 Jun 2023 10:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=02timQVtu6aTaDZlo3R3D4w+fsAbkYRbfC53CEOsKBw=; b=e5lTG91llhH4wWPjAixCgHASoQ gEle+9UxZ6FBfNOKYQG5tbXufVqeX2JO/BNMifZCSCFBf+Eu+u6KxoYOmP7zTnftJyD/f7PuJAfO+ GhBUJKrVqcLzsJzVrH2HyzuFShUiMSqkikpXxPKcT0/0caDupaOYyKzNzwb6w6jCU7dOb1+brYkY2 WgmpzocQzziisZKh986bzrE0Vz6Cn7SfuzwKH0EFww5gkSfJGjAPX7lddtAAIOiWrC4NxRFfVr8/r XNf1aSU/OI5IhQuHwb2yQL9iaD+fQ8BY8EYj4gBjtT1CVumUxqG7z9c0fWEkomcqJIrJSgJGZ7Pcd xd38NNSw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qCkG4-00GdfI-Oa; Fri, 23 Jun 2023 17:07:40 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: Fix sparse warnings in backing-dev.h Date: Fri, 23 Jun 2023 18:07:37 +0100 Message-Id: <20230623170737.3965705-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769516544098899216?= X-GMAIL-MSGID: =?utf-8?q?1769516544098899216?= Sparse reports a context imbalance, and indeed _begin() returns with the RCU lock held and _end() releases it. Reassure sparse that this is fine by adding appropriate annotations. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/backing-dev.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index fbad4fcd408e..69bb13412a3e 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -284,8 +284,9 @@ static inline struct bdi_writeback *inode_to_wb_wbc( * can't sleep during the transaction. IRQs may or may not be disabled on * return. */ -static inline struct bdi_writeback * -unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie) +static inline +struct bdi_writeback *unlocked_inode_to_wb_begin(struct inode *inode, + struct wb_lock_cookie *cookie) __acquires(RCU) { rcu_read_lock(); @@ -311,7 +312,7 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie) * @cookie: @cookie from unlocked_inode_to_wb_begin() */ static inline void unlocked_inode_to_wb_end(struct inode *inode, - struct wb_lock_cookie *cookie) + struct wb_lock_cookie *cookie) __releases(RCU) { if (unlikely(cookie->locked)) xa_unlock_irqrestore(&inode->i_mapping->i_pages, cookie->flags);