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: <20180206141418.GA25912@eng-minchan1.roam.corp.google.com>
Date:   Tue, 6 Feb 2018 06:14:18 -0800
From:   Minchan Kim <minchan@...nel.org>
To:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
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

Hi Sergey,

On Tue, Feb 06, 2018 at 06:48:22PM +0900, Sergey Senozhatsky wrote:
> 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.

Agree.

> 
> > +       /* 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;
> 	}

Looks better but it introduces frontswap thing to swap_slots.c while
all frontswap works in swapfile.c.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ