Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2659669iob; Mon, 16 May 2022 03:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysMIPq4PuXdmBoyE95+us7zrGbaGcw1VAfHpLlaH+itVyFyuitulZ/cjl0UYjMmJxT0VAo X-Received: by 2002:a7b:ce04:0:b0:394:1f46:213 with SMTP id m4-20020a7bce04000000b003941f460213mr15868739wmc.157.1652696633807; Mon, 16 May 2022 03:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652696633; cv=none; d=google.com; s=arc-20160816; b=SRZH6TUg2EHkh7ACMWD8n/xnBP0NII9U/e+P48XwBUwWluFmnNcZDa+e2vKlzlZ0Z9 I7uSkbR0YBZ6jExYWEVepGhxh8KPNUA/kU+y5ufEBDEG7Cil4dWKQ8L4vWrg2zumVLQH 0YJErtJwjuPpNQqfoWkMmT1WNGUul28nEbHDOmVQsZkBsXlNhbXsyKUJMCMD3kzi8PFb Hb6CHIYZBI8mbRO8/azvI6LMcLA7ucl8j8WlC25a0igxZAQbW4miI66zvBAqAqVM5DKg bqPaO4v2ThWl9SuQwzDLxP/LZK2yapnOwWplX23xE0AxTLiQYn3qHhgCrW1yJPJwB1qR kynQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ydcWfsPw3YPcL0QLXJclXHSAHtFm/3PTkpWvHuoVnEk=; b=hjBxeOdsVN/hA40858UfAhZpdjIQuEoIBj6dzifK99Ol6kN1ZU53fTYe2z7Jy2F+T2 W19HvKKMzr/37wSlGXpBGj3QuorgsNIenwoVeLegIrRQnVv3kw/IQ51ad15enGDErk+r sqjgJv0CByqvy3h1RixhPhFFzfLWa7rFp2jDN7DnEvJ/DFtBTIfEJqS/HWk5m1X19Yf4 xqAudR57hlsWX6wV6cyob5SUiE8nsU2I659Ph5rLxBERhpyot2TSL3Du/7BjwxYauZxp gWxfN/2j140YnZo3D5va+X9qQNTpia+IxI6Arh8OsfQhIeAMd6QRyIlifqPDC6DQ4MVQ FO5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a0560001d8d00b0020aa329aa15si8413513wrb.944.2022.05.16.03.23.26; Mon, 16 May 2022 03:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239845AbiEPFlU convert rfc822-to-8bit (ORCPT + 99 others); Mon, 16 May 2022 01:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239382AbiEPFlD (ORCPT ); Mon, 16 May 2022 01:41:03 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB257DF48 for ; Sun, 15 May 2022 22:41:02 -0700 (PDT) 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 24G2AJ8K024664 for ; Sun, 15 May 2022 22:41:02 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3g29htyaxf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sun, 15 May 2022 22:41:02 -0700 Received: from twshared13345.18.frc3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sun, 15 May 2022 22:41:00 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 348F37AEBBF4; Sun, 15 May 2022 22:40:56 -0700 (PDT) From: Song Liu To: , CC: , , , , , , , Song Liu Subject: [PATCH bpf-next 0/5] bpf_prog_pack followup Date: Sun, 15 May 2022 22:40:46 -0700 Message-ID: <20220516054051.114490-1-song@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: MYYkFMWdwEtZUhOy9XbCF-4Tn8W6XQZR X-Proofpoint-GUID: MYYkFMWdwEtZUhOy9XbCF-4Tn8W6XQZR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-15_11,2022-05-13_01,2022-02-23_01 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Resending the set, as the original ones didn't make through the maillist. As of 5.18-rc6, x86_64 uses bpf_prog_pack on 4kB pages. This set contains two followups: 1/5 - 3/5 fills unused part of bpf_prog_pack with illegal instructions. 4/5 - 5/5 enables bpf_prog_pack on 2MB pages. The primary goal of bpf_prog_pack is to reduce iTLB miss rate and reduce direct memory mapping fragmentation. This leads to non-trivial performance improvements. For our web service production benchmark, bpf_prog_pack on 4kB pages gives 0.5% to 0.7% more throughput than not using bpf_prog_pack. bpf_prog_pack on 2MB pages 0.6% to 0.9% more throughput than not using bpf_prog_pack. Note that 0.5% is a huge improvement for our fleet. I believe this is also significant for other companies with many thousand servers. bpf_prog_pack on 2MB pages may use slightly more memory for systems without many BPF programs. However, such waste in memory (<2MB) is within noisy for modern x86_64 systems. Song Liu (5): bpf: fill new bpf_prog_pack with illegal instructions x86/alternative: introduce text_poke_set bpf: introduce bpf_arch_text_invalidate for bpf_prog_pack module: introduce module_alloc_huge bpf: use module_alloc_huge for bpf_prog_pack arch/x86/include/asm/text-patching.h | 1 + arch/x86/kernel/alternative.c | 70 ++++++++++++++++++++++++---- arch/x86/kernel/module.c | 21 +++++++++ arch/x86/net/bpf_jit_comp.c | 5 ++ include/linux/bpf.h | 1 + include/linux/moduleloader.h | 5 ++ kernel/bpf/core.c | 30 ++++++++---- kernel/module.c | 8 ++++ 8 files changed, 122 insertions(+), 19 deletions(-) -- 2.30.2