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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91D6EC433FE for ; Thu, 17 Nov 2022 20:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A3118E0001; Thu, 17 Nov 2022 15:01:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 253466B0075; Thu, 17 Nov 2022 15:01:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11B878E0001; Thu, 17 Nov 2022 15:01:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F2FF86B0073 for ; Thu, 17 Nov 2022 15:01:38 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6EE3AABB59 for ; Thu, 17 Nov 2022 20:01:38 +0000 (UTC) X-FDA: 80144004276.30.3C334B0 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id F332314000D for ; Thu, 17 Nov 2022 20:01:36 +0000 (UTC) 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668715297; a=rsa-sha256; cv=none; b=2nIeebgnE5KoLwZ6VwcsvD31jmJkkxDnSJhChCJwlAVgmTHzbU1gaUU4DNqOTpmi+yTEuD dzZXQMTI+c+BgldIpDzsH9unlpmCQOLF8BsVIzSlPgEt+smFMVc+7uEYnKDchwn5XHDLCL 1HZ0xAwsOxzuYfCHlObV6Th8PxzRzCY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=FvpGXh2Y; spf=none (imf26.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668715297; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WggsTmhV+WYowxD4r/psjeorh95yhSvkxYMzmQRrIB4=; b=7onLQykD5oY5UalGymNhGhlpQqsJkbGWaryqWjpElWb4hDJdD83h644c2aegkoPt57oVZl 8xbw9TYdpCZ8whNT2MZJCYC1coSv2VHmQCJ+bm+N6q+SjuA9G5nJVwxAnmH/dqLfxChf2u Xp61U/MEkRSZlujus+s42OB5m8lmwZ4= X-Stat-Signature: todmi4ystombe3by8im7b45ptubaifpy X-Rspamd-Queue-Id: F332314000D X-Rspamd-Server: rspam01 X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=FvpGXh2Y; spf=none (imf26.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1668715296-150015 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: 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