Re: [patch 3/9] mm: shmem: save one radix tree lookup when truncating swapped pages

Minchan Kim
2013-11-25T08:21:09Z

On Sun, Nov 24, 2013 at 06:38:22PM -0500, Johannes Weiner wrote:
> Page cache radix tree slots are usually stabilized by the page lock,
> but shmem's swap cookies have no such thing. Because the overall
> truncation loop is lockless, the swap entry is currently confirmed by
> a tree lookup and then deleted by another tree lookup under the same
> tree lock region.
>
> Use radix_tree_delete_item() instead, which does the verification and
> deletion with only one lookup. This also allows removing the
> delete-only special case from shmem_radix_tree_replace().
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Minchan Kim <minchan@kernel.org>

Nice cleanup!

--
Kind regards,
Minchan Kim