Re: [PATCH 4/5] mm: Use radix_tree_iter_retry()

From: Vlastimil Babka
Date: Fri Jan 29 2016 - 09:46:09 EST


On 01/27/2016 10:17 PM, Matthew Wilcox wrote:
> From: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
>
> Instead of a 'goto restart', we can now use radix_tree_iter_retry()
> to restart from our current position. This will make a difference
> when there are more ways to happen across an indirect pointer. And it
> eliminates some confusing gotos.
>
> Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>

[...]

> diff --git a/mm/shmem.c b/mm/shmem.c
> index fa2ceb2d2655..6ec14b70d82d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -388,8 +388,10 @@ restart:
> * don't need to reset the counter, nor do we risk infinite
> * restarts.
> */
> - if (radix_tree_deref_retry(page))
> - goto restart;
> + if (radix_tree_deref_retry(page)) {
> + slot = radix_tree_iter_retry(&iter);
> + continue;
> + }
>
> if (radix_tree_exceptional_entry(page))
> swapped++;

This should be applied on top. There are no restarts anymore.

----8<----