On Thu 19 Sep 2019 at 01:56, Cong Wang <xiyou.wangc...@gmail.com> wrote:
> On Wed, Sep 18, 2019 at 12:32 AM Vlad Buslov <vla...@mellanox.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.

Reply via email to