From patchwork Tue Mar 16 15:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12142557 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 28651C433E0 for ; Tue, 16 Mar 2021 15:40:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4D79650F3 for ; Tue, 16 Mar 2021 15:40:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4D79650F3 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 60B8E6B0075; Tue, 16 Mar 2021 11:40:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E2736B0078; Tue, 16 Mar 2021 11:40:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AA846B007D; Tue, 16 Mar 2021 11:40:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 321F96B0075 for ; Tue, 16 Mar 2021 11:40:10 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D4CEB180AD837 for ; Tue, 16 Mar 2021 15:40:09 +0000 (UTC) X-FDA: 77926148538.02.D41EF2B Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by imf09.hostedemail.com (Postfix) with ESMTP id 70DAB600249C for ; Tue, 16 Mar 2021 15:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1615909202; x=1647445202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KqzASXGhrTuQ3KDFC8H+v0fbPkS9czuEH52WiGTsxDU=; b=T1haH0RYbPwtn/aNHtfXfS84odca9HeUXwDUCmrE2dUiyO2igb9jPPe9 tt1R8/SbR971SlU2gb1mghuDb8eNgfT+fgxzx3t5foWYbiGNAvy4YS9TD aatZ+V9Jq8cbNesbuph9vnJJf6Rxw9jwNUF33p33zYkw7L1yPLpvznToc g=; X-IronPort-AV: E=Sophos;i="5.81,251,1610409600"; d="scan'208";a="120908366" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-67b371d8.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 16 Mar 2021 15:39:54 +0000 Received: from EX13D31EUA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1a-67b371d8.us-east-1.amazon.com (Postfix) with ESMTPS id 15EF9A1EC3; Tue, 16 Mar 2021 15:39:51 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.213) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 15:39:47 +0000 From: SeongJae Park To: CC: , , , , , SeongJae Park Subject: [PATCH v2] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD' Date: Tue, 16 Mar 2021 16:39:30 +0100 Message-ID: <20210316153930.29827-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210316094910.23827-1-sjpark@amazon.com> References: <20210316094910.23827-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.162.213] X-ClientProxiedBy: EX13D40UWA003.ant.amazon.com (10.43.160.29) To EX13D31EUA001.ant.amazon.com (10.43.165.15) X-Stat-Signature: 7ndz6zbsyhmtyza9mucfgdpyb1mpzoat X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 70DAB600249C Received-SPF: none (amazon.de>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=smtp-fw-9102.amazon.com; client-ip=207.171.184.29 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615909201-444801 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: From: SeongJae Park Commit 49eeab03fa0a ("userfaultfd: support minor fault handling for shmem") introduced shmem_mcopy_atomic_pte(). The function is declared in 'userfaultfd_k.h' when 'CONFIG_USERFAULTFD' is defined, and defined as 'BUG()' if the config is unset. However, the definition of the function in 'shmem.c' is not protected by the '#ifdef' macro. As a result, the build fails when the config is not set. This commit fixes the problem. Fixes: 49eeab03fa0a ("userfaultfd: support minor fault handling for shmem") Signed-off-by: SeongJae Park --- Changes from v1 - Remove unnecessary internal code review URL --- mm/shmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 547df2b766f7..c0d3abefeb3f 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2359,6 +2359,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode return inode; } +#ifdef CONFIG_USERFAULTFD int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr, @@ -2492,6 +2493,7 @@ int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd, shmem_inode_unacct_blocks(inode, 1); goto out; } +#endif #ifdef CONFIG_TMPFS static const struct inode_operations shmem_symlink_inode_operations;