From patchwork Fri May 20 23:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 12857585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF8BC433EF for ; Sat, 21 May 2022 00:01:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C15956B0072; Fri, 20 May 2022 20:01:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0086B0073; Fri, 20 May 2022 20:01:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A66006B0074; Fri, 20 May 2022 20:01:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 94F266B0072 for ; Fri, 20 May 2022 20:01:33 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6F6F7205EB for ; Sat, 21 May 2022 00:01:33 +0000 (UTC) X-FDA: 79487796066.13.B2334C8 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf07.hostedemail.com (Postfix) with ESMTP id F379A40016 for ; Sat, 21 May 2022 00:01:23 +0000 (UTC) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24KMsDbU018349 for ; Fri, 20 May 2022 17:01:32 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3g59tby96s-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 20 May 2022 17:01:32 -0700 Received: from twshared14818.18.frc3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Fri, 20 May 2022 17:01:29 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 84DCB7E2220E; Fri, 20 May 2022 16:58:23 -0700 (PDT) From: Song Liu To: , , CC: , , , , , , , Song Liu Subject: [PATCH v4 bpf-next 7/8] vmalloc: introduce huge_vmalloc_supported Date: Fri, 20 May 2022 16:57:57 -0700 Message-ID: <20220520235758.1858153-8-song@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220520235758.1858153-1-song@kernel.org> References: <20220520235758.1858153-1-song@kernel.org> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: _uWtTYdMcIX32PodIS7iDeOtG3_b1wBE X-Proofpoint-GUID: _uWtTYdMcIX32PodIS7iDeOtG3_b1wBE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-20_08,2022-05-20_02,2022-02-23_01 X-Stat-Signature: wfbsytpw67uhkbt9crazcabi1bbxmnnf X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=kernel.org (policy=none); spf=none (imf07.hostedemail.com: domain of "prvs=6140678c23=songliubraving@fb.com" has no SPF policy when checking 67.231.153.30) smtp.mailfrom="prvs=6140678c23=songliubraving@fb.com" X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: F379A40016 X-HE-Tag: 1653091283-600580 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: 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 5e0d0a60d9d5..22e81c1813bd 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -242,11 +242,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 07da85ae825b..d3b11317b025 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);