From patchwork Tue Mar 16 09:49:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12141635 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 474D8C433E0 for ; Tue, 16 Mar 2021 09:49:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C443865013 for ; Tue, 16 Mar 2021 09:49:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C443865013 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 43B496B006E; Tue, 16 Mar 2021 05:49:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EAC86B0070; Tue, 16 Mar 2021 05:49:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D9D96B0071; Tue, 16 Mar 2021 05:49:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id 0F6776B006E for ; Tue, 16 Mar 2021 05:49:46 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BF7AC6C16 for ; Tue, 16 Mar 2021 09:49:45 +0000 (UTC) X-FDA: 77925265530.01.54BFFFB Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf14.hostedemail.com (Postfix) with ESMTP id 33D19C0007CA for ; Tue, 16 Mar 2021 09:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1615888186; x=1647424186; h=from:to:cc:subject:date:message-id:mime-version; bh=Bdv4AWMzINQWXCqWNH2A+ni0wM6jP0NbcmnsluplFJ8=; b=WdJ9PsCKq85lDQRz3X386R+a8TPNS4aZrjNrCleZ9pm6C5bCYaEULi5/ 1Og1/qMMxN7ON5RELRuHBQPpbqfzqJnQ1T16y/jSpf0j8Gy+y1jwA9smL OI3934Kiyevpl/U7pLGszXo31p+Yv9Tv59IxnipJfcCVBFyxZB7Jw4dc5 k=; X-IronPort-AV: E=Sophos;i="5.81,251,1610409600"; d="scan'208";a="97705161" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 16 Mar 2021 09:49:38 +0000 Received: from EX13D31EUA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com (Postfix) with ESMTPS id D2C82A18A1; Tue, 16 Mar 2021 09:49:35 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.239) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 09:49:31 +0000 From: SeongJae Park To: CC: , , , , , SeongJae Park Subject: [PATCH] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD' Date: Tue, 16 Mar 2021 10:49:10 +0100 Message-ID: <20210316094910.23827-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.43.162.239] X-ClientProxiedBy: EX13D19UWA003.ant.amazon.com (10.43.160.170) To EX13D31EUA001.ant.amazon.com (10.43.165.15) X-Stat-Signature: c737zprwwtqz9fie5tmujejfjyicbt7i X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 33D19C0007CA Received-SPF: none (amazon.de>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=smtp-fw-6002.amazon.com; client-ip=52.95.49.90 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615888185-567494 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 cr https://code.amazon.com/reviews/CR-47204463 --- 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;