Re: [patch 02/10] fs: cachefiles: use add_to_page_cache_lru()

From: Johannes Weiner
Date: Sun Feb 09 2014 - 12:36:00 EST


On Sat, Feb 08, 2014 at 09:43:35AM -0200, Rafael Aquini wrote:
> On Mon, Feb 03, 2014 at 07:53:34PM -0500, Johannes Weiner wrote:
> > This code used to have its own lru cache pagevec up until a0b8cab3
> > ("mm: remove lru parameter from __pagevec_lru_add and remove parts of
> > pagevec API"). Now it's just add_to_page_cache() followed by
> > lru_cache_add(), might as well use add_to_page_cache_lru() directly.
> >
>
> Just a heads-up, here: take a look at https://lkml.org/lkml/2014/2/7/587

Ah, yes. That patch replaced a private pagevec, which consumes the
references you pass in, with add_to_page_cache_lru(), which gets its
own references.

My patch changes

add_to_page_cache()
lru_cache_add()

to

add_to_page_cache_lru()
add_to_page_cache()
lru_cache_add()

so the refcounting does not change for the caller.

Thanks for pointing it out, though, it never hurts to double check
stuff like that.
--
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/