lkml.org 
[lkml]   [2013]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 01/02] swap: discard while swapping only if SWAP_FLAG_DISCARD_PAGES
On Sun, May 26, 2013 at 9:52 AM, Rafael Aquini <aquini@redhat.com> wrote:
> On Sun, May 26, 2013 at 07:44:56AM -0400, KOSAKI Motohiro wrote:
>> > + /*
>> > + * By flagging sys_swapon, a sysadmin can tell us to
>> > + * either do sinle-time area discards only, or to just
>> > + * perform discards for released swap page-clusters.
>> > + * Now it's time to adjust the p->flags accordingly.
>> > + */
>> > + if (swap_flags & SWAP_FLAG_DISCARD_ONCE)
>> > + p->flags &= ~SWP_PAGE_DISCARD;
>> > + else if (swap_flags & SWAP_FLAG_DISCARD_PAGES)
>> > + p->flags &= ~SWP_AREA_DISCARD;
>>
>> When using old swapon(8), this code turn off both flags, right
>
> As the flag that enables swap discards SWAP_FLAG_DISCARD remains meaning the
> same it meant before, when using old swapon(8) (SWP_PAGE_DISCARD|SWP_AREA_DISCARD)

But old swapon(8) don't use neigher SWAP_FLAG_DISCARD_ONCE nor
SWAP_FLAG_DISCARD_PAGES. It uses only SWAP_FLAG_DISCARD. So, this
condition disables both SWP_PAGE_DISCARD and SWP_AREA_DISCARD.

And you changed that SWP_DISCARDABLE is not checked in IO path at all.

>- if (si->flags & SWP_DISCARDABLE) {
>+ if (si->flags & SWP_PAGE_DISCARD) {

I suggest new swapon(8) don't pass SWP_DISCARDABLE and kernel handle
SWP_DISCARDABLE as (SWAP_FLAG_DISCARD_ONCE | SWAP_FLAG_DISCARD_PAGES).

Optionally, warn SWP_DISCARDABLE is a good idea.


> will remain flagged when discard is enabled, so we keep doing discards the same way
> we did before (at swapon, and for every released page-cluster).
> The flags are removed orthogonally only when the new swapon(8) selects one of the
> particular discard policy available by using either SWAP_FLAG_DISCARD_ONCE,
> or SWAP_FLAG_DISCARD_PAGES flags.
>


\
 
 \ /
  Last update: 2013-05-26 17:41    [W:0.061 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site