Re: [PATCH] mm/shmem: Do not wait for lock_page() in shmem_unused_huge_shrink()

From: Kirill A. Shutemov
Date: Fri Mar 16 2018 - 09:34:51 EST


On Fri, Mar 16, 2018 at 10:14:24PM +0900, Tetsuo Handa wrote:
> f2fs is doing
>
> page = f2fs_pagecache_get_page(inode->i_mapping, 0, FGP_LOCK|FGP_NOWAIT, 0);
>
> which calls
>
> struct page *pagecache_get_page(inode->i_mapping, 0, FGP_LOCK|FGP_NOWAIT, 0);
>
> . Then, can't we define
>
> static inline struct page *find_trylock_page(struct address_space *mapping,
> pgoff_t offset)
> {
> return pagecache_get_page(mapping, offset, FGP_LOCK|FGP_NOWAIT, 0);
> }
>
> and replace find_lock_page() with find_trylock_page() ?

This won't work in this case. We need to destinct no-page-in-page-cache
from failed-to-lock-page. We take different routes depending on this.

--
Kirill A. Shutemov