Re: [PATCH] files: rcu free files_struct

From: Linus Torvalds
Date: Wed Dec 09 2020 - 18:30:19 EST


On Wed, Dec 9, 2020 at 3:07 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> #. It is not necessary to use rcu_assign_pointer() when creating
> linked structures that are to be published via a single external
> - pointer. The RCU_INIT_POINTER() macro is provided for this task
> - and also for assigning ``NULL`` pointers at runtime.
> + pointer. The RCU_INIT_POINTER() macro is provided for this task.
> + It used to be more efficient to use RCU_INIT_POINTER() to store a
> + ``NULL`` pointer, but rcu_assign_pointer() now optimises for a constant
> + ``NULL`` pointer itself.

I would just remove the historical note about "It used to be more
efficient ..". It's not really helpful.

If somebody wants to dig into the history, it's there in git.

Maybe the note could be part of the commit message for the comment
update, explaining that it used to be more efficient but no longer is.
Because commit messages are about the explanation for the change.

But I don't feel it makes any sense in the source code.

Linus