Re: [B.A.T.M.A.N.] slowpath warning

Andrew Lunn
2010-03-01T05:59:55Z

Hi Simon

> @@ -503,15 +550,23 @@
> unsigned long flags;
>
> spin_lock_irqsave(&vis_hash_lock, flags);
> +
> purge_vis_packets();
>
> - if (generate_vis_packet() == 0)
> + if (generate_vis_packet() == 0) {
> /* schedule if generation was successful */
> + kref_get(&my_vis_info->refcount);
> list_add_tail(&my_vis_info->send_list, &send_list);
> + }
>
> list_for_each_entry_safe(info, temp, &send_list, send_list) {
> + spin_unlock_irqrestore(&vis_hash_lock, flags);
> +
> + send_vis_packet(info);
> +
> + spin_lock_irqsave(&vis_hash_lock, flags);
> list_del_init(&info->send_list);
> - send_vis_packet(info);
> + kref_put(&info->refcount, free_info);
> }
> spin_unlock_irqrestore(&vis_hash_lock, flags);
> start_vis_timer();

Although you say this works, i just looks wrong. It looks
unbalanced. Where is the kref_put for my_vis_info->refcount? There is
a kref_put inside what looks like a loop, but no kref_get inside the
loop.

Can you explain this is more detail? Can we make it look correctly
balanced?

Thanks
Andrew