From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C546C43217 for ; Thu, 17 Nov 2022 20:01:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240590AbiKQUBh (ORCPT ); Thu, 17 Nov 2022 15:01:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbiKQUBg (ORCPT ); Thu, 17 Nov 2022 15:01:36 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C587EC9A for ; Thu, 17 Nov 2022 12:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WggsTmhV+WYowxD4r/psjeorh95yhSvkxYMzmQRrIB4=; b=FvpGXh2Y/Q+5uFG4WyxeL+GVkB BW3nQ5IZ6xpL1HPWDPgL9ejmXk02nOnH/K/2aFdZibK/qMfKisH56kIKqHrx0RbhvgCcrgpE7q/X2 aileK+jPiLimIgJdnozqpYQzoSzi5XNxom2YRflPCKz6bA11HILi46KU+dPKX+hLumnyMkz9K98mV BmklloZT8Nzeqb24dzPBAGdhnLEZ265XoOxn6TI9iu55Bb/QyIyCvL78yAzoPCzJyLwxTU8M5YFqh e23o5VWur6UCm+iBef1pCsGQK0OZEnovGqNfc/QkTgkRgt1HulwARcA8NzvtiTT/+ShtNgChYuJs9 5CTLtDIA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovl4k-00H49x-VA; Thu, 17 Nov 2022 20:01:30 +0000 Date: Thu, 17 Nov 2022 12:01:30 -0800 From: Luis Chamberlain To: Alexei Starovoitov Cc: Song Liu , bpf , linux-mm , Andrew Morton , X86 ML , Peter Zijlstra , Christoph Hellwig , Rick Edgecombe , aaron.lu@intel.com, Mike Rapoport Subject: Re: [PATCH bpf-next v3 4/6] bpf: use execmem_alloc for bpf program and bpf dispatcher Message-ID: References: <20221117010621.1891711-1-song@kernel.org> <20221117010621.1891711-5-song@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, Nov 16, 2022 at 06:10:23PM -0800, Alexei Starovoitov wrote: > On Wed, Nov 16, 2022 at 6:04 PM Luis Chamberlain wrote: > > > > On Wed, Nov 16, 2022 at 05:06:19PM -0800, Song Liu wrote: > > > Use execmem_alloc, execmem_free, and execmem_fill instead of > > > bpf_prog_pack_alloc, bpf_prog_pack_free, and bpf_arch_text_copy. > > > > > > execmem_free doesn't require extra size information. Therefore, the free > > > and error handling path can be simplified. > > > > > > There are some tests that show the benefit of execmem_alloc. > > > > > > Run 100 instances of the following benchmark from bpf selftests: > > > tools/testing/selftests/bpf/bench -w2 -d100 -a trig-kprobe > > > which loads 7 BPF programs, and triggers one of them. > > > > > > Then use perf to monitor TLB related counters: > > > perf stat -e iTLB-load-misses,itlb_misses.walk_completed_4k, \ > > > itlb_misses.walk_completed_2m_4m -a > > > > > > The following results are from a qemu VM with 32 cores. > > > > > > Before bpf_prog_pack: > > > iTLB-load-misses: 350k/s > > > itlb_misses.walk_completed_4k: 90k/s > > > itlb_misses.walk_completed_2m_4m: 0.1/s > > > > > > With bpf_prog_pack (current upstream): > > > iTLB-load-misses: 220k/s > > > itlb_misses.walk_completed_4k: 68k/s > > > itlb_misses.walk_completed_2m_4m: 0.2/s > > > > > > With execmem_alloc (with this set): > > > iTLB-load-misses: 185k/s > > > itlb_misses.walk_completed_4k: 58k/s > > > itlb_misses.walk_completed_2m_4m: 1/s > > > > Wonderful. > > > > It would be nice to have this integrated into the bpf selftest, > > > No. Luis please stop suggesting things that don't make sense. > selftest/bpf are not doing performance benchmarking. > We have the 'bench' tool for that. > That's what Song used and it's only running standalone > and not part of any CI. I'm not suggesting to instantiate the VM or crap like that, I'm just asking for the simple script to run 100 instances. This allows folks to reproduce results in an easy way. Whether or not you don't want that for selftests/bpf -- fine, a simple in commit script can easily represent a loop in bash if that's all that was done. Luis