Re: [v4][PATCH 2/6] mm: swap: make 'struct page' and swp_entry_tvariants of swapcache_free().

From: Minchan Kim
Date: Mon Jun 03 2013 - 02:13:31 EST


Hello Dave,

On Fri, May 31, 2013 at 11:38:58AM -0700, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> swapcache_free() takes two arguments:
>
> void swapcache_free(swp_entry_t entry, struct page *page)
>
> Most of its callers (5/7) are from error handling paths haven't even
> instantiated a page, so they pass page=NULL. Both of the callers
> that call in with a 'struct page' create and pass in a temporary
> swp_entry_t.
>
> Now that we are deferring clearing page_private() until after
> swapcache_free() has been called, we can just create a variant
> that takes a 'struct page' and does the temporary variable in
> the helper.
>
> That leaves all the other callers doing
>
> swapcache_free(entry, NULL)
>
> so create another helper for them that makes it clear that they
> need only pass in a swp_entry_t.
>
> One downside here is that delete_from_swap_cache() now does
> an extra swap_address_space() call. But, those are pretty
> cheap (just some array index arithmetic).

I lost from this description.

Old behavior

delete_from_swap_cache
swap_address_space
__delete_from_swap_cache
swap_address_space


New behavior

delete_from_swap_cache
__delete_from_swap_cache
swap_address_space

So you removes a swap_address_space, not adding a extra call.
Am I missing something?

>
> Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

Otherwise, looks good to me
Reviewed-by: Minchan Kim <minchan@xxxxxxxxxx>

--
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/