From patchwork Wed Mar 10 18:53:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12129047 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 1E5EFC433E0 for ; Wed, 10 Mar 2021 18:54:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D26B64EF9 for ; Wed, 10 Mar 2021 18:54:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D26B64EF9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CE1A58D01FC; Wed, 10 Mar 2021 13:54:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C8F458D01ED; Wed, 10 Mar 2021 13:54:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B574B8D01FC; Wed, 10 Mar 2021 13:54:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 98FBA8D01ED for ; Wed, 10 Mar 2021 13:54:05 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 58C9A181AEF23 for ; Wed, 10 Mar 2021 18:54:05 +0000 (UTC) X-FDA: 77904864450.29.1A59785 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 3078AC0007D5 for ; Wed, 10 Mar 2021 18:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615402444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pzZMGqMZc5zPC1EGzN2nTjjo+4+DdAetFkEenwTjWtA=; b=OtYoF4o2utpYedeKjYbBtXKf829YK+p83eiwnI5SvscMJOQpWkhb1ty7xD9iTMa9OVw4O4 Z+ah4OuKgFBdQqHOItIAGcxOyaFlmc/CSWVVQYyPSKd0gw7Y3rw/i8OQQYciXAkrjvYZ5t I8Z2C1bpzCGztqI0t9ayLxQiJduQVmc= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-583-sgEBxNxINY2WJ3b15q-zUw-1; Wed, 10 Mar 2021 13:54:02 -0500 X-MC-Unique: sgEBxNxINY2WJ3b15q-zUw-1 Received: by mail-qv1-f69.google.com with SMTP id s16so13397112qvw.3 for ; Wed, 10 Mar 2021 10:54:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pzZMGqMZc5zPC1EGzN2nTjjo+4+DdAetFkEenwTjWtA=; b=NmeRH9dH1tjlsN5zMFQC67PK9WSKTrSsdsQZjqsfGcNAUYfqzHscYG8wi8u8qenrlS 7o+MgCVQxcHgXyzEhOEjbdJJytIU7t1CY+td4V1Daf/JbqZLusCUTyckbb8e8rYiLKUP u8Mte0G9YTV8vmeLMijaeuC/e5hr6RNNMF0P4diOPhQG2sZ8mCXhiXduo4tS6Z65ifXx m9xU5kNj0JNanHYLCjYFaOtQUG5DPh4cDp7bJ4673uw4oACnLq0/F4WSMLqYdouYNttx lVFnQTIpHzj1DyPV6OCDM8z/Ji3nsV/8sRqyaYk1juKnEAEg6ZyKyfyFUxGtDTInRGxa GfYQ== X-Gm-Message-State: AOAM530JbeedvGgQlk8d4B7dU7Hl8NzaknC0C3kMQTqZIPxDRSldQFjE UrcjZlAHCWOoseRug2VdU1WtAF+Qf8EcAskQ4EcyvD63ieXrN0dRrtTFMJVvmoUSULTKwY/a+3W BEK5OJbFHZsA= X-Received: by 2002:a0c:9cc2:: with SMTP id j2mr757153qvf.2.1615402442009; Wed, 10 Mar 2021 10:54:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzjMCDHSbDkzp7mfaySFzMCURsVRYA7nqf9LW48wmg8OE27/TnP4Tqly23M2PBZk9jZ8OL6A== X-Received: by 2002:a0c:9cc2:: with SMTP id j2mr757127qvf.2.1615402441776; Wed, 10 Mar 2021 10:54:01 -0800 (PST) Received: from localhost.localdomain ([142.126.89.138]) by smtp.gmail.com with ESMTPSA id d14sm140519qkg.33.2021.03.10.10.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 10:54:01 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Andrew Morton , Mike Kravetz , Axel Rasmussen , Naresh Kamboju Subject: [PATCH] mm/hugetlb: Fix build with !ARCH_WANT_HUGE_PMD_SHARE Date: Wed, 10 Mar 2021 13:53:59 -0500 Message-Id: <20210310185359.88297-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: 7djqw3cjdqiy6k79mfq8jqm9u7n5ot6j X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3078AC0007D5 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf22; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615402441-788461 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: want_pmd_share() is undefined with !ARCH_WANT_HUGE_PMD_SHARE since it's put by accident into a "#ifdef ARCH_WANT_HUGE_PMD_SHARE" block. Moving it out won't work either since vma_shareable() is only defined within the block. Define it for !ARCH_WANT_HUGE_PMD_SHARE instead. Fixes: 5b109cc1cdcc ("hugetlb/userfaultfd: forbid huge pmd sharing when uffd enabled") Cc: Andrew Morton Cc: Mike Kravetz Cc: Axel Rasmussen Reported-by: Naresh Kamboju Tested-by: Naresh Kamboju Signed-off-by: Peter Xu Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d58f1456fe27..8dda7e034477 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5469,9 +5469,6 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr) bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr) { -#ifndef CONFIG_ARCH_WANT_HUGE_PMD_SHARE - return false; -#endif #ifdef CONFIG_USERFAULTFD if (uffd_disable_huge_pmd_share(vma)) return false; @@ -5616,6 +5613,11 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, unsigned long *start, unsigned long *end) { } + +bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr) +{ + return false; +} #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */ #ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB