From patchwork Wed Aug 24 09:10:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12953075 X-Patchwork-Delegate: kuba@kernel.org 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 A898DC00140 for ; Wed, 24 Aug 2022 09:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235216AbiHXJHZ (ORCPT ); Wed, 24 Aug 2022 05:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiHXJHY (ORCPT ); Wed, 24 Aug 2022 05:07:24 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDBC37647E; Wed, 24 Aug 2022 02:07:22 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MCKs21WJ9zkWPl; Wed, 24 Aug 2022 17:03:50 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 17:07:19 +0800 From: Zhengchao Shao To: , , , , , , , , CC: , , Subject: [PATCH net-next] net: sched: remove unnecessary init of qidsc skb head Date: Wed, 24 Aug 2022 17:10:03 +0800 Message-ID: <20220824091003.15935-1-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The memory allocated by using kzallloc_node and kcalloc has been cleared. Therefore, the structure members of the new qdisc are 0. So there's no need to explicitly assign a value of 0. Signed-off-by: Zhengchao Shao --- include/net/sch_generic.h | 7 ------- net/sched/sch_generic.c | 1 - net/sched/sch_htb.c | 2 -- 3 files changed, 10 deletions(-) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index ec693fe7c553..dcdb8474ed68 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -940,13 +940,6 @@ static inline void qdisc_purge_queue(struct Qdisc *sch) qdisc_tree_reduce_backlog(sch, qlen, backlog); } -static inline void qdisc_skb_head_init(struct qdisc_skb_head *qh) -{ - qh->head = NULL; - qh->tail = NULL; - qh->qlen = 0; -} - static inline void __qdisc_enqueue_tail(struct sk_buff *skb, struct qdisc_skb_head *qh) { diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index d47b9689eba6..0c0f20f7b9f5 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -941,7 +941,6 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, goto errout; __skb_queue_head_init(&sch->gso_skb); __skb_queue_head_init(&sch->skb_bad_txq); - qdisc_skb_head_init(&sch->q); gnet_stats_basic_sync_init(&sch->bstats); spin_lock_init(&sch->q.lock); diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 23a9d6242429..f43414e42ad5 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1106,8 +1106,6 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, if (err < 0) goto err_free_direct_qdiscs; - qdisc_skb_head_init(&q->direct_queue); - if (tb[TCA_HTB_DIRECT_QLEN]) q->direct_qlen = nla_get_u32(tb[TCA_HTB_DIRECT_QLEN]); else