lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180206094822.GA2265@jagdpanzerIV>
Date:   Tue, 6 Feb 2018 18:48:22 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Minchan Kim <minchan@...nel.org>
Cc:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Dan Streetman <ddstreet@...e.org>,
        Seth Jennings <sjenning@...hat.com>,
        Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
        Shaohua Li <shli@...nel.org>, Michal Hocko <mhocko@...e.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Shakeel Butt <shakeelb@...gle.com>, stable@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ