Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp816235iog; Fri, 24 Jun 2022 15:03:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uHV83gEBurjVyS68ga/y+UtqV1xByiNMsBszOmoyoMmGvlkNnE53ufiJfAEzF5L8r1NQML X-Received: by 2002:a17:90b:3b82:b0:1ec:ac0d:5d3b with SMTP id pc2-20020a17090b3b8200b001ecac0d5d3bmr6419317pjb.158.1656108191576; Fri, 24 Jun 2022 15:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656108191; cv=none; d=google.com; s=arc-20160816; b=aukGZ8J+s8uB2fgKqVlMIX7HOIMIpcFQtVOWOjIMpbirXRutHwcfCcQ/NOLsVP0Swv ueo4PPWhe0Ic7T82hz3zP9usypvCAqmk4I0cw93IIfZr2e+GDdmEZ3ULkt36iuRvml9W BCQlTzIbJlMkqciMDWoZQjPIxDfeIMqpdFFNchUjNUlglMfZ8DxZEn5sZguPXVmjh2PH 2/yo4JmDl5BIHkdM01zaZstXvHyhZLERwvZ0UZfxiv+SAwbXiq0LSYHBoWfB+1UaWrEy AlHw8lO74tCtkg4GMqoXfelqYaqjgxvf8VHLuGp8YRz6vScDl45l3q83J1DrahC2SnIL 0Now== 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=LXZ/mgxdQpqrrrTxhZwv4riWi4FGg5lHB6oGbRupKnz1XJAc9vIX5WfG16ielYIT1r MKWIte5G8rVdIs08dvvIAvghixsGFmAl6HYm5Cs876sel19MGM7YOL0MX73roBQU8h4i RJqNhcfzTEtGCQ5nWNacrkaI1w08FzAniOAguw7MfjqQZfDWsHl/zWhb2C7p+m5k02BK QP4ICkKaUgyQ89tEHWq8QzxrGRphHQRasBn4V9m69LHeGJNxXMLIlQTDY/531Gd8ZACo VK/umPRuCHmPWltY48Wq1t4idvTq8elTWpsOlrfBpvKy/rIi2uznYBgOPtaDyRns6vrD qzjw== 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 f9-20020a63f109000000b00408a9ceb56esi4086918pgi.594.2022.06.24.15.02.59; Fri, 24 Jun 2022 15:03: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 S231998AbiFXV5t convert rfc822-to-8bit (ORCPT + 99 others); Fri, 24 Jun 2022 17:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiFXV5l (ORCPT ); Fri, 24 Jun 2022 17:57:41 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC03487D4A for ; Fri, 24 Jun 2022 14:57:40 -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 25OLaB0T018071 for ; Fri, 24 Jun 2022 14:57:40 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3gvvmjgfcp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 24 Jun 2022 14:57:40 -0700 Received: from twshared5413.23.frc3.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; Fri, 24 Jun 2022 14:57:39 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 52D0694C3A3C; Fri, 24 Jun 2022 14:57:28 -0700 (PDT) From: Song Liu To: , , CC: , , , , , Song Liu Subject: [PATCH v5 bpf-next 4/5] vmalloc: introduce huge_vmalloc_supported Date: Fri, 24 Jun 2022 14:57:11 -0700 Message-ID: <20220624215712.3050672-5-song@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624215712.3050672-1-song@kernel.org> References: <20220624215712.3050672-1-song@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: 1V_946ppO6HWmlH_8yWDoCHMtCVoOcGm X-Proofpoint-GUID: 1V_946ppO6HWmlH_8yWDoCHMtCVoOcGm 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-06-24_09,2022-06-24_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