Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2296897iof; Wed, 8 Jun 2022 01:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpTa2J3th2MOztNpggOngKrzuBcqhAoKPjr+XZYJcJNXTcI2QoppCeTPACm0g8MvwDj6ty X-Received: by 2002:a63:874a:0:b0:3fe:c72:ec50 with SMTP id i71-20020a63874a000000b003fe0c72ec50mr5615414pge.141.1654677952230; Wed, 08 Jun 2022 01:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654677952; cv=none; d=google.com; s=arc-20160816; b=D/pfdh7Ii35vjOmICHOkZPu/hKUViHSyNL62Auo5S/lHtRgjwFuCJZ8OpA/gD/oT1n kUzavRdZX4MVZZjfN+DAXKNMFC00KIvylQ/VB57pIeJehPo8O8dAZztnsQCyj+f1gWzy zfU8CJpBUVJ9zkQCra83SDEWqNmHMjkQ/7fiq8IWhhIVG38uEEXc8MIWotmf6/CUU0DM RrJxALXOspaTNw6dU726XZSts7maxfHzyoFerdX9mJUdEskWZOQP0AS5W/BUAc4kMKow TkE0v2H6FWWLuPp+HvMkAk7f3L5/9YOJ7mEXLXRws7ov29+CZqIp0Yt0abEyhZzkEF/G dtEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=6g4MB/2Lu7rQpbPpIMGixYDX9MXNU274v9OKdeffZbE=; b=ltyIgqgj9hzWFQTtUzXlcy/JPbN6uIUcEQctFB9q4oLZtNCDiE/QcizDM/s08XQBge OwlredzjHgvt9lSQI/nM+DY3G+zgFz2aZYNm4wFqHMJlOW7x0bAGmdOGXuVdbhX+lBMU 2K4Tq1NHjT1Te/YTgbGXGFe0iRL2LpNfJDTipM+yX8Hj09PnfeOBy3yzmQnnUX1npe5I /NmiHQX8+jGAUpFJbtJ7fQlygsnCrv9N3yri9refoxqr4buV/H83ItLtvIMGT5CLHxfq OQZkCIu3oFBe102+5ny+ulsfg7fVA5DgVWW/+Xo0zkdDiGIMWg07Go1vocKCzJwnfrp/ 3z1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=pSdZVDbL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w13-20020a170902d70d00b00163cdf1a201si25512573ply.265.2022.06.08.01.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=pSdZVDbL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E7152C7E41; Wed, 8 Jun 2022 01:09:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbiFHIHn (ORCPT + 99 others); Wed, 8 Jun 2022 04:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232904AbiFHIG3 (ORCPT ); Wed, 8 Jun 2022 04:06:29 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B418F1CFFC for ; Wed, 8 Jun 2022 00:37:56 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id h192so11360605pgc.4 for ; Wed, 08 Jun 2022 00:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=6g4MB/2Lu7rQpbPpIMGixYDX9MXNU274v9OKdeffZbE=; b=pSdZVDbLtC/3kmSefKRvlaXakVXelgwC1LmIxeoggEHIPsYTM9oY+c50BbB3MN1PzZ ztRFxTMXCEi/LS6ReqEC+yhwuRpPNpew1aCkacxLjxR+6o8OvNELaAsWed2mu0Xy6sTg LSC1LWWTeG7iGZRH05OvKUo0DiKuzpZmUSR8Sh65yaCZOFYdFx9/pz9EcoYZFEEkvYHA 0Hq4TPs+geit3UTfWCan84JbIcCbRdIQ3xXgpxpgMqodxhIEqGiSsIJmiXW2gxR0ahaw nZkU0vR8+nCzgHPDxKmftwe6aafPfUhZlp/pF7dQ2WCZDa2ne/pn+zPxaN9gGS6BzQ9J ANuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=6g4MB/2Lu7rQpbPpIMGixYDX9MXNU274v9OKdeffZbE=; b=Qv/GNf4meQORV6bYD1aHUEp7nuzTwARUM2o6aZB6vOJVRCJGtoZ+CikGrOHzVon9jH EeproJy6bCLyWMbtClDdvM2NYPPe67tFMQM7oCMGtryCFM791lgVZcTMOA3CP+hDMFKK U2e2ea7BhWTKqGf+AE3DXWEgQYiLRv0x/Fww7cdSihTy3XVSgUomFjyyj/eyk1umFa6i ORtMHG25K7XskIqPBojV8IOKR0ko2+vx8q4c7iyU52unXeqqA1/Y8SODdS60vdiY22RQ BeX/YuiaXEGVVJ6gFmC5kqJINjajj09GQUfwneVK8DUUaQycVddNPFIX3AP1D9n8ds4y nzQQ== X-Gm-Message-State: AOAM530D6HDSgLd5VD0/CsXWirz0/zHMxnwbRjQT39FzqRKVPe0F8nPV KUvyNCldq8gepA6ld45zT1ivhQ== X-Received: by 2002:a65:668b:0:b0:3f6:4026:97cd with SMTP id b11-20020a65668b000000b003f6402697cdmr28764470pgw.420.1654673876321; Wed, 08 Jun 2022 00:37:56 -0700 (PDT) Received: from [10.71.57.194] ([139.177.225.241]) by smtp.gmail.com with ESMTPSA id s18-20020aa78d52000000b0050dc76281fdsm14134299pfe.215.2022.06.08.00.37.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jun 2022 00:37:55 -0700 (PDT) Message-ID: Date: Wed, 8 Jun 2022 15:37:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [External] Re: [PATCH v5 1/2] bpf: avoid grabbing spin_locks of all cpus when no free elems To: Alexei Starovoitov Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Network Development , bpf , LKML , Xiongchun Duan , Muchun Song , Dongdong Wang , Cong Wang , Chengming Zhou References: <20220608021050.47279-1-zhoufeng.zf@bytedance.com> <20220608021050.47279-2-zhoufeng.zf@bytedance.com> From: Feng Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 在 2022/6/8 上午11:39, Alexei Starovoitov 写道: > On Tue, Jun 7, 2022 at 7:11 PM Feng zhou wrote: >> From: Feng Zhou >> >> This patch use head->first in pcpu_freelist_head to check freelist >> having free or not. If having, grab spin_lock, or check next cpu's >> freelist. >> >> Before patch: hash_map performance >> ./map_perf_test 1 >> 0:hash_map_perf pre-alloc 975345 events per sec >> 4:hash_map_perf pre-alloc 855367 events per sec >> 12:hash_map_perf pre-alloc 860862 events per sec >> 8:hash_map_perf pre-alloc 849561 events per sec >> 3:hash_map_perf pre-alloc 849074 events per sec >> 6:hash_map_perf pre-alloc 847120 events per sec >> 10:hash_map_perf pre-alloc 845047 events per sec >> 5:hash_map_perf pre-alloc 841266 events per sec >> 14:hash_map_perf pre-alloc 849740 events per sec >> 2:hash_map_perf pre-alloc 839598 events per sec >> 9:hash_map_perf pre-alloc 838695 events per sec >> 11:hash_map_perf pre-alloc 845390 events per sec >> 7:hash_map_perf pre-alloc 834865 events per sec >> 13:hash_map_perf pre-alloc 842619 events per sec >> 1:hash_map_perf pre-alloc 804231 events per sec >> 15:hash_map_perf pre-alloc 795314 events per sec >> >> hash_map the worst: no free >> ./map_perf_test 2048 > The commit log talks about some private patch > you've made to map_perf_test. > Please use numbers from the bench added in the 2nd patch. > Also trim commit log to only relevant parts. > ftrace dumps and numbers from all cpus are too verbose > for commit log. Ok, will do. Thanks.