Re: [PATCH][ATM] make atm (and clip) modular + try_module_get()

From: chas williams (chas@locutus.cmf.nrl.navy.mil)
Date: Wed Mar 05 2003 - 10:08:42 EST


In message <20030305.063158.53514369.davem@redhat.com>,"David S. Miller" writes
:
>If you own both objects, why lock anything?

i believe the original intent was to prevent anyone else from
appending to either of the lists while the lists are being joined.
while it would be slightly less efficient, should it use the
skb primitives? this is quite a bit easier to read:

void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to)
{
        struct sk_buff *skb;
        unsigned long flags;

        local_irq_save(flags);
        spin_lock(&to->lock);
        spin_lock(&from->lock);

        while(skb = __skb_dequeue(from))
                __skb_queue_tail(to, skb);

        spin_unlock(&to->lock);
        spin_unlock(&from->lock);
        local_irq_restore(flags);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:28 EST