[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vbfwoe4k6k7.fsf@mellanox.com>
Date: Thu, 19 Sep 2019 08:56:42 +0000
From: Vlad Buslov <vladbu@...lanox.com>
To: Cong Wang <xiyou.wangcong@...il.com>
CC: Vlad Buslov <vladbu@...lanox.com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Jiri Pirko <jiri@...nulli.us>,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH net 2/3] net: sched: multiq: don't call qdisc_put() while
holding tree lock
On Thu 19 Sep 2019 at 01:56, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Wed, Sep 18, 2019 at 12:32 AM Vlad Buslov <vladbu@...lanox.com> wrote:
>> diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
>> index e1087746f6a2..4cfa9a7bd29e 100644
>> --- a/net/sched/sch_multiq.c
>> +++ b/net/sched/sch_multiq.c
>> @@ -187,18 +187,21 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
>>
>> sch_tree_lock(sch);
>> q->bands = qopt->bands;
>> + sch_tree_unlock(sch);
>> +
>> for (i = q->bands; i < q->max_bands; i++) {
>> if (q->queues[i] != &noop_qdisc) {
>> struct Qdisc *child = q->queues[i];
>>
>> + sch_tree_lock(sch);
>> q->queues[i] = &noop_qdisc;
>> qdisc_tree_flush_backlog(child);
>> + sch_tree_unlock(sch);
>> +
>> qdisc_put(child);
>> }
>> }
>
> Repeatedly acquiring and releasing a spinlock in a loop
> does not seem to be a good idea. Is it possible to save
> those qdisc pointers to an array or something similar?
>
> Thanks.
Sure. I implemented it the way I did because following loop in
multiq_tune() is implemented in exactly the same way: it repeatedly
acquires and releases sch tree lock for each new default Qdisc that it
creates.
Powered by blists - more mailing lists