lkml.org 
[lkml]   [2018]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm] mm, swap, frontswap: Fix THP swap if frontswap enabled
Hello,

On (02/06/18 01:02), Minchan Kim wrote:
[..]
> Can't we simple do like that if you want to make it simple and rely on someone
> who makes frontswap THP-aware later?
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 42fe5653814a..4bf1725407aa 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -934,7 +934,11 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[])
>
> /* Only single cluster request supported */
> WARN_ON_ONCE(n_goal > 1 && cluster);
> +#ifdef CONFIG_FRONTSWAP

Wouldn't #ifdef CONFIG_THP_SWAP be better? frontswap_enabled() is 'false'
on CONFIG_FRONTSWAP configs, should be compiled out anyway.

> + /* Now, frontswap doesn't support THP page */
> + if (frontswap_enabled() && cluster)
> + return;
> +#endif
> avail_pgs = atomic_long_read(&nr_swap_pages) / nr_pages;
> if (avail_pgs <= 0)
> goto noswap;

Looks interesting. Technically, can be done earlier - in get_swap_page(),
can't it? get_swap_page() has the PageTransHuge(page) && CONFIG_THP_SWAP
condition checks. Can add frontswap dependency there. Something like

if (PageTransHuge(page)) {
if (IS_ENABLED(CONFIG_THP_SWAP))
+ if (!frontswap_enabled())
get_swap_pages(1, true, &entry);
return entry;
}

-ss

\
 
 \ /
  Last update: 2018-02-06 10:48    [W:0.122 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site