From patchwork Mon Apr 5 20:37:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 12183575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAED6C433B4 for ; Mon, 5 Apr 2021 20:41:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 17F89613CF for ; Mon, 5 Apr 2021 20:41:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17F89613CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5B9A06B0070; Mon, 5 Apr 2021 16:41:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5697E6B0073; Mon, 5 Apr 2021 16:41:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40AB86B0075; Mon, 5 Apr 2021 16:41:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 217086B0070 for ; Mon, 5 Apr 2021 16:41:39 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C85541804DF70 for ; Mon, 5 Apr 2021 20:41:38 +0000 (UTC) X-FDA: 77999484276.01.7B4A984 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf11.hostedemail.com (Postfix) with ESMTP id 1BA5B2000254 for ; Mon, 5 Apr 2021 20:41:33 +0000 (UTC) IronPort-SDR: 4nPE41ojTsrgDZWdZiooRRLBHfcYTaWwW2AVdJSooxhePz1K7tt7+x04UPvQptA4gz99T/a5Jr tDEEUNVojmfg== X-IronPort-AV: E=McAfee;i="6000,8403,9945"; a="278169236" X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="278169236" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2021 13:41:33 -0700 IronPort-SDR: QFEDzoWXO1ygMicp1OeYto9bUwmZvOPj374kIoHYcrRxoffFr+5T26SS/8qXoJyO1fia6fCPJc OgSg/xsMC1tw== X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="418078025" Received: from rpedgeco-mobl3.amr.corp.intel.com (HELO localhost.intel.com) ([10.212.230.218]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2021 13:41:32 -0700 From: Rick Edgecombe To: akpm@linux-foundation.org, linux-mm@kvack.org, bpf@vger.kernel.org, dave.hansen@linux.intel.com, peterz@infradead.org, luto@kernel.org, jeyu@kernel.org Cc: linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, hch@infradead.org, x86@kernel.org, Rick Edgecombe Subject: [RFC 0/3] Group pages on the direct map for permissioned vmallocs Date: Mon, 5 Apr 2021 13:37:08 -0700 Message-Id: <20210405203711.1095940-1-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 1BA5B2000254 X-Stat-Signature: mmn93g9kfwyddkpceouy1kwyoz8ztob9 X-Rspamd-Server: rspam02 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mga05.intel.com; client-ip=192.55.52.43 X-HE-DKIM-Result: none/none X-HE-Tag: 1617655293-979044 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: Hi, This is a followup to the previous attempt to overhaul how vmalloc permissions are done: https://lore.kernel.org/lkml/20201120202426.18009-1-rick.p.edgecombe@intel.com/ In working on a next version it dawned on me that we can significantly reduce direct map breakage on x86 with a much less invasive change, so I thought maybe I would start there in the meantime. In a test of booting fedora and running the BPF unit tests, this reduced 4k direct map pages by 98%. It simply uses pages for x86 module_alloc() mappings from a cache created out of 2MB pages. This results in all the later breakage clustering in 2MB blocks on the direct map. The trade-off is colder pages are used for these allocations. All module_alloc() users (modules, ebpf jit, ftrace, kprobes) get this behavior. Potentially this behavior should be enabled for eBPF byte code allocations as well in the case of !CONFIG_BPF_JIT_ALWAYS_ON. The new APIs and invasive changes in the callers can happen after vmalloc huge pages bring more benefits. Although, I can post shootdown reduction changes with previous comments integrated if anyone disagrees. Based on v5.11. Thanks, Rick Rick Edgecombe (3): list: Support getting most recent element in list_lru vmalloc: Support grouped page allocations x86/module: Use VM_GROUP_PAGES flag arch/x86/Kconfig | 1 + arch/x86/kernel/module.c | 2 +- include/linux/list_lru.h | 13 +++ include/linux/vmalloc.h | 1 + mm/Kconfig | 9 ++ mm/list_lru.c | 28 +++++ mm/vmalloc.c | 215 +++++++++++++++++++++++++++++++++++++-- 7 files changed, 257 insertions(+), 12 deletions(-)