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 X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B75CC433E0 for ; Tue, 16 Mar 2021 02:42:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEF6765053 for ; Tue, 16 Mar 2021 02:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234720AbhCPCla (ORCPT ); Mon, 15 Mar 2021 22:41:30 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3478 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbhCPClH (ORCPT ); Mon, 15 Mar 2021 22:41:07 -0400 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4DzyD90d23zRQP8; Tue, 16 Mar 2021 10:39:21 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 16 Mar 2021 10:41:04 +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, 16 Mar 2021 10:41:04 +0800 Subject: Re: [PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb To: David Miller CC: , , , , , , References: <1615800610-34700-1-git-send-email-linyunsheng@huawei.com> <20210315.164151.1093629330365238718.davem@redhat.com> From: Yunsheng Lin Message-ID: <1fea8225-69b0-5a73-0e9d-f5bfdecdc840@huawei.com> Date: Tue, 16 Mar 2021 10:40: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: <20210315.164151.1093629330365238718.davem@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme707-chm.china.huawei.com (10.1.199.103) 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/16 7:41, David Miller wrote: > From: Yunsheng Lin > Date: Mon, 15 Mar 2021 17:30:10 +0800 > >> Currently qdisc_lock(q) is taken before enqueuing and dequeuing >> for lockless qdisc's skb_bad_txq/gso_skb queue, qdisc->seqlock is >> also taken, which can provide the same protection as qdisc_lock(q). >> >> This patch removes the unnecessay qdisc_lock(q) protection for >> lockless qdisc' skb_bad_txq/gso_skb queue. >> >> And dev_reset_queue() takes the qdisc->seqlock for lockless qdisc >> besides taking the qdisc_lock(q) when doing the qdisc reset, >> some_qdisc_is_busy() takes both qdisc->seqlock and qdisc_lock(q) >> when checking qdisc status. It is unnecessary to take both lock >> while the fast path only take one lock, so this patch also changes >> it to only take qdisc_lock(q) for locked qdisc, and only take >> qdisc->seqlock for lockless qdisc. >> >> Since qdisc->seqlock is taken for lockless qdisc when calling >> qdisc_is_running() in some_qdisc_is_busy(), use qdisc->running >> to decide if the lockless qdisc is running. >> >> Signed-off-by: Yunsheng Lin > > What about other things protected by this lock, such as statistics and qlen? > > This change looks too risky to me. Ok, If that is the case, maybe we just remove qdisc->seqlock and use qdisc_lock(q) for lockless qdisc too, so that we do not need to worry about "lockless qdisc' other things protected by qdisc_lock(q)". At least for the fast path, taking two locks for lockless qdisc hurts performance when handling requeued skb, especially if the lockless qdisc supports TCQ_F_CAN_BYPASS. > > > . >