[PATCH v3 hmm 06/12] mm/hmm: Hold on to the mmget for the lifetime of the range
Christoph Hellwig
hch at infradead.org
Wed Jun 19 11:54:21 UTC 2019
On Wed, Jun 19, 2019 at 08:34:52AM -0300, Jason Gunthorpe wrote:
> /**
> * list_empty_careful - tests whether a list is empty and not being modified
> * @head: the list to test
> *
> * Description:
> * tests whether a list is empty _and_ checks that no other CPU might be
> * in the process of modifying either member (next or prev)
> *
> * NOTE: using list_empty_careful() without synchronization
> * can only be safe if the only activity that can happen
> * to the list entry is list_del_init(). Eg. it cannot be used
> * if another CPU could re-list_add() it.
> */
>
> Agree it doesn't seem obvious why this is relevant when checking the
> list head..
>
> Maybe the comment is a bit misleading?
>From looking at the commit log in the history tree list_empty_careful
was initially added by Linus, and then mingo added that comment later.
I don't see how list_del_init would change anything here, so I suspect
list_del_init was just used as a short hand for list_del or
list_del_init.
More information about the amd-gfx
mailing list