X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=mm%2Finternal.h;h=91d1d3828093af01a48e657093750782de7d7090;hb=9c315e4d7d8c3bddad3893777bbab4164b298818;hp=3cf20ab3ca01f31db206a92ad3dd0d0fd22e0119;hpb=7347f09a198a045d5f6ea5e9c8fcc1db98e5a854;p=linux-2.6-microblaze.git diff --git a/mm/internal.h b/mm/internal.h index 3cf20ab3ca01..91d1d3828093 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -63,6 +63,29 @@ static inline unsigned long ra_submit(struct file_ra_state *ra, ra->start, ra->size, ra->async_size); } +/** + * page_evictable - test whether a page is evictable + * @page: the page to test + * + * Test whether page is evictable--i.e., should be placed on active/inactive + * lists vs unevictable list. + * + * Reasons page might not be evictable: + * (1) page's mapping marked unevictable + * (2) page is part of an mlocked VMA + * + */ +static inline bool page_evictable(struct page *page) +{ + bool ret; + + /* Prevent address_space of inode and swap cache from being freed */ + rcu_read_lock(); + ret = !mapping_unevictable(page_mapping(page)) && !PageMlocked(page); + rcu_read_unlock(); + return ret; +} + /* * Turn a non-refcounted page (->_refcount == 0) into refcounted with * a count of one.