On Fri, Jan 24, 2020 at 05:35:44PM -0800, Matthew Wilcox wrote:
> @@ -192,8 +194,18 @@ unsigned long __do_page_cache_readahead(struct 
> address_space *mapping,
>               page = __page_cache_alloc(gfp_mask);
>               if (!page)
>                       break;
> -             page->index = page_offset;
> -             list_add(&page->lru, &page_pool);
> +             if (use_list) {
> +                     page->index = page_offset;
> +                     list_add(&page->lru, &page_pool);
> +             } else if (!add_to_page_cache_lru(page, mapping, page_offset,
> +                                     gfp_mask)) {
> +                     if (nr_pages)
> +                             read_pages(mapping, filp, &page_pool,
> +                                             page_offset - nr_pages,
> +                                             nr_pages);
> +                     nr_pages = 0;

This is missing a call to put_page().

> +                     continue;
> +             }
>               if (page_idx == nr_to_read - lookahead_size)
>                       SetPageReadahead(page);
>               nr_pages++;


Reply via email to