lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpW5r=nY889aiu53_CBPxNyMWQzQG53f5Ouhm+B1Njh7Pw@mail.gmail.com>
Date:	Wed, 14 Oct 2015 21:13:21 -0700
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>,
	Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [Patch net-next 1/4] net_sched: introduce qdisc_replace() helper

On Tue, Oct 13, 2015 at 6:54 PM, David Miller <davem@...emloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Mon, 12 Oct 2015 11:38:00 -0700
>
>> Remove nearly duplicated code and prepare for the following patch.
>>
>> Cc: Jamal Hadi Salim <jhs@...atatu.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
>
> This isn't an equivalent transformation:
>
>> +static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
>> +                                       struct Qdisc **pold)
>> +{
>> +     struct Qdisc *old;
>> +
>> +     sch_tree_lock(sch);
>> +     old = *pold;
>> +     *pold = new;
>> +     if (old != NULL) {
>> +             qdisc_tree_decrease_qlen(old, old->q.qlen);
>> +             qdisc_reset(old);
>> +     }
>> +     sch_tree_unlock(sch);
>> +
>> +     return old;
>> +}
>> +
>
> Is not the same as:
>
>> diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
>> index f26bdea..c76cdd4 100644
>> --- a/net/sched/sch_drr.c
>> +++ b/net/sched/sch_drr.c
>> @@ -226,11 +226,7 @@ static int drr_graft_class(struct Qdisc *sch, unsigned long arg,
>>                       new = &noop_qdisc;
>>       }
>>
>> -     sch_tree_lock(sch);
>> -     drr_purge_queue(cl);
>> -     *old = cl->qdisc;
>> -     cl->qdisc = new;
>> -     sch_tree_unlock(sch);
>> +     *old = qdisc_replace(sch, new, &cl->qdisc);
>>       return 0;
>>  }
>>
>
> This.
>
> If you want to change semantics, you must do it explicitly in a separate
> commit with a detailed commit message explaining how and why.

If you meant drr_purge_queue(),  it is same:

static void drr_purge_queue(struct drr_class *cl)
{
        unsigned int len = cl->qdisc->q.qlen;

        qdisc_reset(cl->qdisc);
        qdisc_tree_decrease_qlen(cl->qdisc, len);
}

Or if you mean the 'if', always having one if doesn't harm, do it?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ