From patchwork Thu Aug 18 22:42:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 12948108 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 738FAC00140 for ; Thu, 18 Aug 2022 22:51:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 176EC8E0001; Thu, 18 Aug 2022 18:51:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 127E48D0002; Thu, 18 Aug 2022 18:51:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F31078E0001; Thu, 18 Aug 2022 18:51:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E34AD8D0002 for ; Thu, 18 Aug 2022 18:51:49 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7037516245C for ; Thu, 18 Aug 2022 22:51:49 +0000 (UTC) X-FDA: 79814212338.31.6A7560B Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by imf01.hostedemail.com (Postfix) with ESMTP id AED2B4037F for ; Thu, 18 Aug 2022 22:49:09 +0000 (UTC) Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27IKhash015060 for ; Thu, 18 Aug 2022 15:48:12 -0700 Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3j1nn8v4yc-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 18 Aug 2022 15:48:12 -0700 Received: from twshared32421.14.frc2.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c085:11d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 18 Aug 2022 15:48:11 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id AADCDBBF6671; Thu, 18 Aug 2022 15:42:32 -0700 (PDT) From: Song Liu To: , CC: , , , , , , , , Song Liu Subject: [RFC 0/5] vmalloc_exec for modules and BPF programs Date: Thu, 18 Aug 2022 15:42:13 -0700 Message-ID: <20220818224218.2399791-1-song@kernel.org> X-Mailer: git-send-email 2.30.2 X-FB-Internal: Safe X-Proofpoint-GUID: PbMCAqgFnxvCtzqu25bYAF2apXeegi6E X-Proofpoint-ORIG-GUID: PbMCAqgFnxvCtzqu25bYAF2apXeegi6E X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_16,2022-08-18_01,2022-06-22_01 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660862950; 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: references; bh=bVN+8wlbEw1AvYRRp5LDFwbRXjtU9cdEdUSrQy1ZTb8=; b=VvHxEVZxwZ+wqR4yx9ciknm6l9JoQlkWr+T/3mxLbjMpacjAkibW60mYtQ2VBbkJmbyR5R S6MjIidHgtpcsvO3SG6wFVpRSSRlMQHtytKHSEEBvU9NVZZ1e1vbeEoVIcyQ7Vkhdn0Khz vZgnXPjUlyGsBZWf+AYAL+bBre+Acoc= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf01.hostedemail.com: domain of "prvs=9229e92ca3=songliubraving@fb.com" designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=9229e92ca3=songliubraving@fb.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660862950; a=rsa-sha256; cv=none; b=6mvwogOzqlLxHnJilJkZ3Iq+DMyUKLwoQIarDmkJVQzSA3y4oYENsO8ubRi9G4zNMlwJT0 OXOcruewFkuVdJdT+c0dk2X1VoBgOmLWK5RvXrfRpmQPvjBgtBKbx6hk78Bg77vMOD3iXL doJZHautdtAnZmATDhv6BfJ+nLnC4NM= Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf01.hostedemail.com: domain of "prvs=9229e92ca3=songliubraving@fb.com" designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=9229e92ca3=songliubraving@fb.com" X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: AED2B4037F X-Stat-Signature: xejpbtefyksosmg8abmjf9crccikc59p X-Rspam-User: X-HE-Tag: 1660862949-102232 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: This set is a prototype that allows dynamic kernel text (modules, bpf programs, various trampolines, etc.) to share huge pages. The idea is similar to Peter's suggestion in [1]. Please refer to each patch for more detais. The ultimate goal is to only host kernel text in 2MB pages (for x86_64). Please share your comments on this. Thanks! [1] https://lore.kernel.org/bpf/Ys6cWUMHO8XwyYgr@hirez.programming.kicks-ass.net/ Song Liu (5): vmalloc: introduce vmalloc_exec and vfree_exec bpf: use vmalloc_exec modules, x86: use vmalloc_exec for module core vmalloc_exec: share a huge page with kernel text vmalloc: vfree_exec: free unused vm_struct arch/x86/Kconfig | 1 + arch/x86/kernel/alternative.c | 30 ++++- arch/x86/kernel/module.c | 1 + arch/x86/mm/init_64.c | 3 +- include/linux/vmalloc.h | 16 +-- kernel/bpf/core.c | 155 ++------------------------ kernel/module/main.c | 23 ++-- kernel/module/strict_rwx.c | 3 - kernel/trace/ftrace.c | 3 +- mm/nommu.c | 7 ++ mm/vmalloc.c | 200 +++++++++++++++++++++++++++++----- 11 files changed, 239 insertions(+), 203 deletions(-) --- 2.30.2