Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4256654imw; Thu, 7 Jul 2022 15:43:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJZdUMBTsIJ1GXA0p1blK5C1DqXuix5IZIWHUQlFWgaSH3IUfX7/DAKl3TbWwEFYyDLDW+ X-Received: by 2002:a17:907:2d24:b0:726:34e6:52fd with SMTP id gs36-20020a1709072d2400b0072634e652fdmr390060ejc.307.1657233791836; Thu, 07 Jul 2022 15:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657233791; cv=none; d=google.com; s=arc-20160816; b=k5f3+a+y+KB7BcNnKVatmjKRIUBL4GNWY7Fa67SQb5ZPqpU2kZfat3IL4MmNsetoLy woylBM0ztdMxD+eH4dPbBK8JtyPfU8OYqJDRLhwK7yHW3fuOuK4Ea3wfIc8pX/c5QMkV kZV/eFYW8TxlChb+YUk2iU2IQ+pUbA4umu9XxlnmWdOyQlgo6ra2o46EbhQJOAkztX9o F+jn7/5Mn936l/ysVexpwiXUomzr8ha48GqxUTgRvPfERVz2/w0MuIKeiVvm3BhqTkvX dtuS3Dw/OYMUGrPYWY4MOQbkHZFBV4URCDziJyDJqQs/CZrY7mgTbwDhuDMoMlBj2Aan GYEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iMnboJ2szNfzBeiJqfDK3k9m9IH31PpfDwP28RPtqSo=; b=p2U9EwTjKvvb9Fv9ZpoekR19T7/IQGKroDO+ChpMh3YeFf21w9dSWz/IRpEDCD4JEK ZFcu4wFgLc+ehwypoYM4TFDs+cK/18bLdJR5AlNO+tA1JmyJnuniNNINHd7NeoV0SEc+ HGrEqajhr48ujimprreuLsUPaOwjuE6Hp0ws0oMeFgqogxLKPaxTaj7/+JjYz4Z084Rz hvYF2DKF9kUQSCoHo30187JGyU/9GIQ7YxaMWGmOyMXQzzKh8Yhqq35/2GNl6B/Fa4Js H7edP9EFc45JeGmF7cB1s/r05uRmCG4EQvwqXv7hI7p/KNf5ZM6GuL6Y808gx33P6y5o Uryg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a056402321900b0043a86563d91si5621172eda.39.2022.07.07.15.42.45; Thu, 07 Jul 2022 15:43:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237033AbiGGWgg convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Jul 2022 18:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236991AbiGGWgb (ORCPT ); Thu, 7 Jul 2022 18:36:31 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B14FE6D for ; Thu, 7 Jul 2022 15:36:31 -0700 (PDT) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 267KPkcX013753 for ; Thu, 7 Jul 2022 15:36:31 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h4uaqsjpa-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 07 Jul 2022 15:36:31 -0700 Received: from twshared34609.14.frc2.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 7 Jul 2022 15:36:28 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 40CF59D349C4; Thu, 7 Jul 2022 15:36:08 -0700 (PDT) From: Song Liu To: , , CC: , , , , , , Song Liu Subject: [PATCH v6 bpf-next 4/5] vmalloc: introduce huge_vmalloc_supported Date: Thu, 7 Jul 2022 15:35:45 -0700 Message-ID: <20220707223546.4124919-5-song@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707223546.4124919-1-song@kernel.org> References: <20220707223546.4124919-1-song@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: H5D4YcKSMhWGUKVEDYYCuSBvE9jLjfzp X-Proofpoint-ORIG-GUID: H5D4YcKSMhWGUKVEDYYCuSBvE9jLjfzp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-07_17,2022-06-28_01,2022-06-22_01 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org huge_vmalloc_supported() exposes vmap_allow_huge so that users of vmalloc APIs could know whether vmalloc will return huge pages. Suggested-by: Rick Edgecombe Signed-off-by: Song Liu --- include/linux/vmalloc.h | 6 ++++++ mm/vmalloc.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 59d3e1f3e108..aa2182959fc5 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -243,11 +243,17 @@ static inline void set_vm_flush_reset_perms(void *addr) if (vm) vm->flags |= VM_FLUSH_RESET_PERMS; } +bool huge_vmalloc_supported(void); #else static inline void set_vm_flush_reset_perms(void *addr) { } + +static inline bool huge_vmalloc_supported(void) +{ + return false; +} #endif /* for /proc/kcore */ diff --git a/mm/vmalloc.c b/mm/vmalloc.c index effd1ff6a4b4..0a5add4b5b2d 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -72,6 +72,11 @@ early_param("nohugevmalloc", set_nohugevmalloc); static const bool vmap_allow_huge = false; #endif /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */ +bool huge_vmalloc_supported(void) +{ + return vmap_allow_huge; +} + bool is_vmalloc_addr(const void *x) { unsigned long addr = (unsigned long)kasan_reset_tag(x); -- 2.30.2