On Thu, Dec 12, 2013 at 12:21 PM, Filipe David Manana
<fdman...@gmail.com> wrote:
> Hello,
>
> I have a list that is manipulated by several threads. Insert, remove
> and iteration are protected by a lock. Is the locking necessary too
> just for checking if the list is empty, i.e., is list_empty()
> atomic/safe to call without the lock held or not?
Which lock are you taking here?If mutex is used then
you still need to take a lock even when you are checking
the list.Incase of spinlock it depends on the code i.e.
if you are writing interrupt handler and if the interrupt
handler can run on all the cores simultaneously then
you still need to protect it with the spinlock AFICT.

best advice is to just take the damn lock.
>
> thanks
>
> --
> Filipe David Manana,
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>
> _______________________________________________
> Kernelnewbies mailing list
> kernelnewb...@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to