summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/swap.h6
2 files changed, 12 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 864d7221de84..8f468e0d2534 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -500,11 +500,20 @@ static inline int page_mapcount(struct page *page)
500 500
501#ifdef CONFIG_TRANSPARENT_HUGEPAGE 501#ifdef CONFIG_TRANSPARENT_HUGEPAGE
502int total_mapcount(struct page *page); 502int total_mapcount(struct page *page);
503int page_trans_huge_mapcount(struct page *page, int *total_mapcount);
503#else 504#else
504static inline int total_mapcount(struct page *page) 505static inline int total_mapcount(struct page *page)
505{ 506{
506 return page_mapcount(page); 507 return page_mapcount(page);
507} 508}
509static inline int page_trans_huge_mapcount(struct page *page,
510 int *total_mapcount)
511{
512 int mapcount = page_mapcount(page);
513 if (total_mapcount)
514 *total_mapcount = mapcount;
515 return mapcount;
516}
508#endif 517#endif
509 518
510static inline struct page *virt_to_head_page(const void *x) 519static inline struct page *virt_to_head_page(const void *x)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0a4cd4703f40..ad220359f1b0 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -418,7 +418,7 @@ extern sector_t swapdev_block(int, pgoff_t);
418extern int page_swapcount(struct page *); 418extern int page_swapcount(struct page *);
419extern int swp_swapcount(swp_entry_t entry); 419extern int swp_swapcount(swp_entry_t entry);
420extern struct swap_info_struct *page_swap_info(struct page *); 420extern struct swap_info_struct *page_swap_info(struct page *);
421extern int reuse_swap_page(struct page *); 421extern bool reuse_swap_page(struct page *, int *);
422extern int try_to_free_swap(struct page *); 422extern int try_to_free_swap(struct page *);
423struct backing_dev_info; 423struct backing_dev_info;
424 424
@@ -513,8 +513,8 @@ static inline int swp_swapcount(swp_entry_t entry)
513 return 0; 513 return 0;
514} 514}
515 515
516#define reuse_swap_page(page) \ 516#define reuse_swap_page(page, total_mapcount) \
517 (!PageTransCompound(page) && page_mapcount(page) == 1) 517 (page_trans_huge_mapcount(page, total_mapcount) == 1)
518 518
519static inline int try_to_free_swap(struct page *page) 519static inline int try_to_free_swap(struct page *page)
520{ 520{