From patchwork Thu Jul 7 22:35:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 12910363 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 79093CCA483 for ; Thu, 7 Jul 2022 22:36:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52C846B0078; Thu, 7 Jul 2022 18:36:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 468476B007B; Thu, 7 Jul 2022 18:36:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 020886B007D; Thu, 7 Jul 2022 18:36:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D7D8F6B0078 for ; Thu, 7 Jul 2022 18:36:31 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B876334E5F for ; Thu, 7 Jul 2022 22:36:31 +0000 (UTC) X-FDA: 79661764182.18.9878127 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by imf12.hostedemail.com (Postfix) with ESMTP id 588614002C for ; Thu, 7 Jul 2022 22:36:31 +0000 (UTC) Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 267KPhtP018282 for ; Thu, 7 Jul 2022 15:36:30 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h5y1dccdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 07 Jul 2022 15:36:30 -0700 Received: from twshared34609.14.frc2.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) 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 X-FB-Internal: Safe X-Proofpoint-GUID: ZQpGZu8-j98xsKQII3WbdBaVO45vYFGM X-Proofpoint-ORIG-GUID: ZQpGZu8-j98xsKQII3WbdBaVO45vYFGM 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657233391; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=SjqbaNnaefnBWQiBhAxgL4uD+qvHCngWIt/mtMQVOlg=; b=HV3z+Fct+LNkdgnFUhLFRd//APHzaVdclRT1jC1wlTIWk+06Hfts/67VmWs0Z8TERaFFe2 fMaHsJZcBtfxmDl1y1OTRdTUg3hrobcUfQTJXjqQomf8ov2/tN6O2UkIhhLJvNhuEEzXE6 FdDDYNO1XUxB2Fv+RXzJZ4qn2hqoh84= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657233391; a=rsa-sha256; cv=none; b=ck5BJOCEZmypboalIUlGF37dFgyHJ/+oyP5BQ6/tzxUGa2/m8h9tZvUzXzr3IEDjdx5FVe EgXr80YfNcZLEeYyPfW5MDNCjtOyesHja4w5h2A+GxjRdlkwFG8E/0sJHMw0FlsbbyFPW7 hBLwzO1zVYictsLbIWA0sorPX9C4LMs= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=none (imf12.hostedemail.com: domain of "prvs=8187d1962c=songliubraving@fb.com" has no SPF policy when checking 67.231.145.42) smtp.mailfrom="prvs=8187d1962c=songliubraving@fb.com"; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=kernel.org (policy=none) X-Rspamd-Queue-Id: 588614002C X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=none; spf=none (imf12.hostedemail.com: domain of "prvs=8187d1962c=songliubraving@fb.com" has no SPF policy when checking 67.231.145.42) smtp.mailfrom="prvs=8187d1962c=songliubraving@fb.com"; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=kernel.org (policy=none) X-Rspamd-Server: rspam03 X-Stat-Signature: 9aewwj4hywydx4otcxt8q9dgepo831dn X-HE-Tag: 1657233391-644834 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 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);