From mboxrd@z Thu Jan 1 00:00:00 1970 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=unavailable 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 CE2CAC433E0 for ; Tue, 16 Mar 2021 15:40:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93796650F3 for ; Tue, 16 Mar 2021 15:40:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230443AbhCPPkR (ORCPT ); Tue, 16 Mar 2021 11:40:17 -0400 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:52656 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbhCPPkA (ORCPT ); Tue, 16 Mar 2021 11:40:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1615909201; x=1647445201; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KqzASXGhrTuQ3KDFC8H+v0fbPkS9czuEH52WiGTsxDU=; b=lcGNSFbl+vPjuht6ALtz3D3bUg/G0DZBAlLicWe+SeV96+8/en9+4Mq0 XHXjrfoNF5T9lc8vhsF8Xx6sS2lH6NDs1hlqYLeeZypzIyMvjNk8MjgsY 4kiCYkmFesGYGA9ehTVOrLpSGWkRIw1TXyHXr2lFn33X8UFx/Rx4Os50U Y=; 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 Content-Type: text/plain 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879