From patchwork Tue Mar 16 14:10:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12142263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D853C433DB for ; Tue, 16 Mar 2021 14:10:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0DF7C65076 for ; Tue, 16 Mar 2021 14:10:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DF7C65076 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 908196B006E; Tue, 16 Mar 2021 10:10:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DFCB6B0070; Tue, 16 Mar 2021 10:10:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A8156B0071; Tue, 16 Mar 2021 10:10:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 60C556B006E for ; Tue, 16 Mar 2021 10:10:54 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1DA6518032815 for ; Tue, 16 Mar 2021 14:10:54 +0000 (UTC) X-FDA: 77925923628.24.C23936A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 0CCB53D6 for ; Tue, 16 Mar 2021 14:10:49 +0000 (UTC) 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=3SHGazn862QXXOeWnSZKkghj7lRt7fQEJXYuLKN9RF0=; b=Ou9YRT2MIVxI7xlEk//ojVHvL1 jUb2JV2gHAQ2B4XLqL9nqvIlIN6cLI4gpMvv7ZLL+ipVgHVhFUPsR9g/NhzyUTLgquxiD9yhBXzow JDwf+sWei38KgIHtyhZxl3uEODhvJDfzA8KRVlb7ypP4ZwcTJ0f2gS0ha2EeC/C95PhCgKVKX3UWS IhqJpoa32c7/uzfZkbA9FNSQQYkfuyE3IfTiZvo5mhPGOZc6q0mysbW5UOhERRL/1zQmRfD7GoDOU ocootX+9+C1iHfK2cX1MjXSKAjWnB+p7J39qu1lnhfb1OKnFdUL66ssYAgm6kVdtan+1Z5967kJE7 cV9sgqzQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lMAPE-0009nt-Ja; Tue, 16 Mar 2021 14:10:45 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org, Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Huang Ying , Mike Rapoport Subject: [PATCH] mm: Move page_mapping_file to pagemap.h Date: Tue, 16 Mar 2021 14:10:40 +0000 Message-Id: <20210316141040.37576-1-willy@infradead.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Stat-Signature: wheng7wnthsiq7of1gjwyqt9youbk77p X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0CCB53D6 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615903849-145870 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: page_mapping_file() is only used by some architectures, and then it is usually only used in one place. Make it a static inline function so other architectures don't have to carry this dead code. Signed-off-by: Matthew Wilcox (Oracle) Reported-by: kernel test robot Reported-by: kernel test robot --- I'm not entirely sure all the affected architectures include pagemap.h, so give this a couple of days for the buildbots to chew on it. include/linux/mm.h | 1 - include/linux/pagemap.h | 10 ++++++++++ mm/util.c | 10 ---------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index fbe0843daa90..f69a72f63e44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1645,7 +1645,6 @@ static inline pgoff_t page_index(struct page *page) bool page_mapped(struct page *page); struct address_space *page_mapping(struct page *page); -struct address_space *page_mapping_file(struct page *page); /* * Return true only if the page has been allocated with diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 08fa117f405c..f68fe61c1dec 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -162,6 +162,16 @@ static inline void filemap_nr_thps_dec(struct address_space *mapping) void release_pages(struct page **pages, int nr); +/* + * For file cache pages, return the address_space, otherwise return NULL + */ +static inline struct address_space *page_mapping_file(struct page *page) +{ + if (unlikely(PageSwapCache(page))) + return NULL; + return page_mapping(page); +} + /* * speculatively take a reference to a page. * If the page is free (_refcount == 0), then _refcount is untouched, and 0 diff --git a/mm/util.c b/mm/util.c index 143c627fb3e8..972e7a0cda5e 100644 --- a/mm/util.c +++ b/mm/util.c @@ -711,16 +711,6 @@ struct address_space *page_mapping(struct page *page) } EXPORT_SYMBOL(page_mapping); -/* - * For file cache pages, return the address_space, otherwise return NULL - */ -struct address_space *page_mapping_file(struct page *page) -{ - if (unlikely(PageSwapCache(page))) - return NULL; - return page_mapping(page); -} - /* Slow path of page_mapcount() for compound pages */ int __page_mapcount(struct page *page) {