From patchwork Mon Feb 19 06:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13562204 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F21A6C48BC3 for ; Mon, 19 Feb 2024 06:27:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD5688D0006; Mon, 19 Feb 2024 01:27:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEB008D0001; Mon, 19 Feb 2024 01:27:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C37B8D0006; Mon, 19 Feb 2024 01:27:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 84DD58D0001 for ; Mon, 19 Feb 2024 01:27:37 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 54909C022C for ; Mon, 19 Feb 2024 06:27:37 +0000 (UTC) X-FDA: 81807572154.08.CC19CBF Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf17.hostedemail.com (Postfix) with ESMTP id DF1F94000B for ; Mon, 19 Feb 2024 06:27:35 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XNYJh366; spf=none (imf17.hostedemail.com: domain of BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708324055; a=rsa-sha256; cv=none; b=pnM+fLqGkm2pyhplLyzkrSEMhk5zFqudQ+rNFIXb26mf43ss+muU18Zcr/JQVXLxqdgViM nL43JdWk643P0OFJIeyKkeeaMTVxWJhQyHIDhyKeIClyK81MqjvACtTm0B3Y2GfUQwiraI 8zZH+kEYOVrOlH5bMtdX0sg/yi+6vkw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XNYJh366; spf=none (imf17.hostedemail.com: domain of BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708324055; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=clOp26eC8FKH7Dvv6yg9RYRM6akZaOkBAUeiLBbKRv8=; b=zqDCiaaEO9MPDHf/SH3oLpa7mBmZIvgzHPU7QKvDfiMv6qdct5v4TOwM5dm11ZEx4hBNZo yByg2Trt3uycL44mGux/twWA3ZyIMndNXKLixfSCOoHHDL3XmeasJbjeDAqdJYE9YGKLpG wfXZBvll6jscNvPzi/RePvud4Lbzsr8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=clOp26eC8FKH7Dvv6yg9RYRM6akZaOkBAUeiLBbKRv8=; b=XNYJh366mgdDIBrZQeDtw84FK1 fHJ00w2tBnxewggSV+MWGfHkf8hwUDGq1lSvdehhAjs488kbF2Ipy9CMdoqbrh1YoTIbbxxPVZgVm yP/Iw1OY64VD6VsqpbL4R1iukf00mL9aUMqiETx0uVqAchTdYndLHXKyUrFKkctgqVG2LNJQQ3LMv CIajI590GSXkr9/EmWh2xbBGshqpqyroAZTaHxxqrDvyOwMds43DrHbKcL6/2qejRNObFRG+PZdQN dHGla2X/BGRjiIc3nidep3Md1mPIY/mmYqDk2ZY/ZukyvBHpzYZ5foD7IdM6irYSaIVqj3RPs/fgY moYT1u6w==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbx7h-00000009F6F-3PHD; Mon, 19 Feb 2024 06:27:30 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: Hui Su , linux-xfs@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox Subject: [PATCH 02/22] shmem: move shmem_mapping out of line Date: Mon, 19 Feb 2024 07:27:10 +0100 Message-Id: <20240219062730.3031391-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219062730.3031391-1-hch@lst.de> References: <20240219062730.3031391-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DF1F94000B X-Stat-Signature: q6wm548hguthzfrcyhntnci7ptirytn6 X-Rspam-User: X-HE-Tag: 1708324055-87625 X-HE-Meta: U2FsdGVkX1+qxo00NTPsfcrGobXQm3WSC5W5g5PofA3Ldp8LPFZAE+L7SBh+ia9e68vajblZQogbbRDDJ67thuTN/gjBEQhxjbM4BLvOyD5npc4EzY2Gr9DG0lUNSS3BQ5vi/wpnXwELoco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=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: shmem_aops really should not be exported to the world. Move shmem_mapping and export it as internal for the one semi-legitimate modular user in udmabuf. This effectively reverts commit 30e6a51dbb05 ("mm/shmem.c: make shmem_mapping() inline"). which added a bogus shmem_aops non-GPL export for no reason whatsoever as there as no shmem_mapping call outside of core MM code at that point. Signed-off-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/shmem_fs.h | 6 +----- mm/shmem.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 2caa6b86106aa3..6b96a87e4bc80a 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -97,11 +97,7 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts); #ifdef CONFIG_SHMEM -extern const struct address_space_operations shmem_aops; -static inline bool shmem_mapping(struct address_space *mapping) -{ - return mapping->a_ops == &shmem_aops; -} +bool shmem_mapping(struct address_space *mapping); #else static inline bool shmem_mapping(struct address_space *mapping) { diff --git a/mm/shmem.c b/mm/shmem.c index d7c84ff621860b..f607b0cab7e4e2 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -254,7 +254,7 @@ static void shmem_inode_unacct_blocks(struct inode *inode, long pages) } static const struct super_operations shmem_ops; -const struct address_space_operations shmem_aops; +static const struct address_space_operations shmem_aops; static const struct file_operations shmem_file_operations; static const struct inode_operations shmem_inode_operations; static const struct inode_operations shmem_dir_inode_operations; @@ -263,6 +263,12 @@ static const struct vm_operations_struct shmem_vm_ops; static const struct vm_operations_struct shmem_anon_vm_ops; static struct file_system_type shmem_fs_type; +bool shmem_mapping(struct address_space *mapping) +{ + return mapping->a_ops == &shmem_aops; +} +EXPORT_SYMBOL_GPL(shmem_mapping); + bool vma_is_anon_shmem(struct vm_area_struct *vma) { return vma->vm_ops == &shmem_anon_vm_ops; @@ -4466,7 +4472,7 @@ static int shmem_error_remove_folio(struct address_space *mapping, return 0; } -const struct address_space_operations shmem_aops = { +static const struct address_space_operations shmem_aops = { .writepage = shmem_writepage, .dirty_folio = noop_dirty_folio, #ifdef CONFIG_TMPFS @@ -4478,7 +4484,6 @@ const struct address_space_operations shmem_aops = { #endif .error_remove_folio = shmem_error_remove_folio, }; -EXPORT_SYMBOL(shmem_aops); static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap,