Re: fs_struct refcounting: spinlock vs atomic
From: Richard Weinberger
Date: Thu Feb 15 2018 - 04:14:36 EST
On Wed, Feb 14, 2018 at 10:13 PM, Enrico Weigelt <lkml@xxxxxxxxx> wrote:
> Hi folks,
>
>
> in fork.c, a spinlock is held for fs_struct refcounting, while other
> places - eg. switch_task_namespaces uses atomic_dec_and_test() on
> the nsproxy.
>
> What's the exact difference here ? Could the atomic counting also used
> for fs_struct ?
Well, the spinlock protects more than just the counter. So atomic won't do it.
--
Thanks,
//richard