From patchwork Thu May 19 20:20:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 12856035 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 BB5F5C433EF for ; Thu, 19 May 2022 20:32:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A12B6B0072; Thu, 19 May 2022 16:32:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 350388D0001; Thu, 19 May 2022 16:32:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 218386B0075; Thu, 19 May 2022 16:32:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1391A6B0072 for ; Thu, 19 May 2022 16:32:24 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E05686106D for ; Thu, 19 May 2022 20:32:23 +0000 (UTC) X-FDA: 79483640166.28.604579D Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf15.hostedemail.com (Postfix) with ESMTP id D0BBBA00D7 for ; Thu, 19 May 2022 20:32:06 +0000 (UTC) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 24JKPmmm012733 for ; Thu, 19 May 2022 13:32:22 -0700 Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net (PPS) with ESMTPS id 3g5h5d4yjh-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 19 May 2022 13:32:22 -0700 Received: from twshared19572.14.frc2.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 19 May 2022 13:32:20 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 2D80D7D58F79; Thu, 19 May 2022 13:21:00 -0700 (PDT) From: Song Liu To: , , CC: , , , , , , , Song Liu Subject: [PATCH v2 bpf-next 7/8] vmalloc: introduce huge_vmalloc_supported Date: Thu, 19 May 2022 13:20:36 -0700 Message-ID: <20220519202037.2401584-8-song@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220519202037.2401584-1-song@kernel.org> References: <20220519202037.2401584-1-song@kernel.org> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: aIKfA7S8jInta7_XNodE8yjQJvEbUsUf X-Proofpoint-ORIG-GUID: aIKfA7S8jInta7_XNodE8yjQJvEbUsUf 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-19_06,2022-05-19_03,2022-02-23_01 X-Stat-Signature: bmzkjzw7kehirohtw8eoonnbm55tgxn9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D0BBBA00D7 X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=none; spf=none (imf15.hostedemail.com: domain of "prvs=61387cfd06=songliubraving@fb.com" has no SPF policy when checking 67.231.153.30) smtp.mailfrom="prvs=61387cfd06=songliubraving@fb.com"; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=kernel.org (policy=none) X-HE-Tag: 1652992326-940835 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 Reported-by: kernel test robot --- include/linux/vmalloc.h | 2 ++ mm/vmalloc.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 5e0d0a60d9d5..3268e7e875ff 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -242,11 +242,13 @@ 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) { } +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);