Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4169170pxf; Tue, 23 Mar 2021 04:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyt2GlLY65OOlqjVBW/6Z8IGN9kkbWrXhNtZ7d4Qx0XI7z1QjvWtqb8BCDw3pXZeOAynFh X-Received: by 2002:a17:907:629e:: with SMTP id nd30mr4400023ejc.407.1616499536296; Tue, 23 Mar 2021 04:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616499536; cv=none; d=google.com; s=arc-20160816; b=vV2c7DvU71KE82xStpkh5Q7+yw1uDqf4EUC1BTMoEKU/l9nXdg5Q+QtcLlBfhiBwKK X0MTUAzdYRBS0zhyvriZ8zoePpdCVZR8B4rJEVyuU0N/K1LMWf7Lg+oxf8M+n/Sifsee eSBlZNzyzHfi69s5HfJjtpx2QaAEIWKGkYGgUfV4iKw1aNfIXJPsP1C26tXbu4Cbz1UP NxKXXygeHylZOc+vAAzaVmYZ/rdJdAJTRhMDzw6exMGLJ2ruIpZ0iT4iirJGiSwAbRVs 9ysS/oIOPa81/1qFJ0mqjVMa1d463CM0YENfdAB4HzS0MEsOMbxpxNfZwFhU4SfxTomH SI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AZ2ZqGqU/xDVQrW2N1t56hb8dLz6NOEmmz4Fnr3gxlc=; b=vWah/wv3xkYfcuSomRqMBDv8u7FjRe1YSZCUCFo/FagZenwRyvyYEgvaW9MtwDLS9G SeAuv7KlZzHECwLrZddXtxklANoTknWfrKAuL+oYS5y6qiL9N0UqX6806Mr1lRUKOytz KJDmdEWN7qu+tVJ3wAMCEMyxXPwZggHBz9pKOZewgVmLTRQ3g8Q2yFRUlcR0Yasg3Zqj 4J/MVukw6Z94VCFggxohh8FfMW2ylufoHXPVHypFh+YVhCGtlX6PtzKN+/f7fc3UpN11 xAVQmf4mSydqQ23Xr/MdQJXudISIf1L5Ey2fnQLVL2BRr2hbq6eC84dgZNBSRK6j3ShZ jeOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lo11si13995574ejb.60.2021.03.23.04.38.33; Tue, 23 Mar 2021 04:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230158AbhCWLfO (ORCPT + 99 others); Tue, 23 Mar 2021 07:35:14 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3919 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbhCWLfB (ORCPT ); Tue, 23 Mar 2021 07:35:01 -0400 Received: from DGGEML403-HUB.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4F4Tkf6Ktbz5hBl; Tue, 23 Mar 2021 19:32:58 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 23 Mar 2021 19:34:56 +0800 Received: from [127.0.0.1] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 23 Mar 2021 19:34:56 +0800 Subject: Re: [RFC v3] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc To: Ahmad Fatoum , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <1616050402-37023-1-git-send-email-linyunsheng@huawei.com> <1616404156-11772-1-git-send-email-linyunsheng@huawei.com> <5bef912e-aa7d-8a27-4d18-ac8cf4f7afdf@pengutronix.de> From: Yunsheng Lin Message-ID: <774fadf5-6383-f9e0-bbc6-e5862482a7d1@huawei.com> Date: Tue, 23 Mar 2021 19:34:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <5bef912e-aa7d-8a27-4d18-ac8cf4f7afdf@pengutronix.de> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme710-chm.china.huawei.com (10.1.199.106) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/23 14:37, Ahmad Fatoum wrote: > Hi, > > On 22.03.21 10:09, Yunsheng Lin wrote: >> Currently pfifo_fast has both TCQ_F_CAN_BYPASS and TCQ_F_NOLOCK >> flag set, but queue discipline by-pass does not work for lockless >> qdisc because skb is always enqueued to qdisc even when the qdisc >> is empty, see __dev_xmit_skb(). >> >> This patch calls sch_direct_xmit() to transmit the skb directly >> to the driver for empty lockless qdisc too, which aviod enqueuing >> and dequeuing operation. qdisc->empty is set to false whenever a >> skb is enqueued, see pfifo_fast_enqueue(), and is set to true when >> skb dequeuing return NULL, see pfifo_fast_dequeue(). >> >> There is a data race between enqueue/dequeue and qdisc->empty >> setting, qdisc->empty is only used as a hint, so we need to call >> sch_may_need_requeuing() to see if the queue is really empty and if >> there is requeued skb, which has higher priority than the current >> skb. >> >> The performance for ip_forward test increases about 10% with this >> patch. >> >> Signed-off-by: Yunsheng Lin >> --- >> Hi, Vladimir and Ahmad >> Please give it a test to see if there is any out of order >> packet for this patch, which has removed the priv->lock added in >> RFC v2. > > Overnight test (10h, 64 mil frames) didn't see any out-of-order frames > between 2 FlexCANs on a dual core machine: > > Tested-by: Ahmad Fatoum > > No performance measurements taken. Thanks for the testing. And I has done the performance measurement. L3 forward testing improves from 1.09Mpps to 1.21Mpps, still about 10% improvement. pktgen + dummy netdev: threads without+this_patch with+this_patch delta 1 2.56Mpps 3.11Mpps +21% 2 3.76Mpps 4.31Mpps +14% 4 5.51Mpps 5.53Mpps +0.3% 8 2.81Mpps 2.72Mpps -3% 16 2.24Mpps 2.22Mpps -0.8% > >>