On 3/17/20 12:04 PM, Matthew Wilcox wrote:
On Wed, Mar 18, 2020 at 01:42:50AM +0800, Yang Shi wrote:
v3: * Fixed the build error reported by lkp.
I'm not terribly enthusiastic about including pagemap.h from swap.h.
It's a discussion that reasonable people can disagree about, so let's
set it up:
This patch adds inline bool page_evictable(struct page *page) to swap.h.
page_evictable() uses mapping_evictable() which is in pagemap.h.
mapping_evictable() uses AS_UNEVICTABLE which is also in pagemap.h.
We could move mapping_evictable() and friends to fs.h (already included
by swap.h). But how about just moving page_evictable() to pagemap.h?
pagemap.h is already included by mm/mlock.c, mm/swap.c and mm/vmscan.c,
which are the only three current callers of page_evictable().
In fact, since it's only called by those three files, perhaps it should
be in mm/internal.h? I don't see it becoming a terribly popular function
to call outside of the core mm code.
I think I have a mild preference for it being in pagemap.h, since I don't
have a hard time convincing myself that it's part of the page cache API,
but I definitely prefer internal.h over swap.h.
Thanks for the suggestion. Will move it to pagemap.h