lkml.org 
[lkml]   [2013]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 02/02] swapon: add "cluster-discard" support
Karel, Motohiro,

Thanks a lot for your time reviewing this patch and providing me with valuable
feedback.

On Tue, May 21, 2013 at 04:17:04PM -0400, KOSAKI Motohiro wrote:
> (5/21/13 6:26 AM), Karel Zak wrote:
> > On Mon, May 20, 2013 at 09:02:43PM -0400, KOSAKI Motohiro wrote:
> >>> - if (fl_discard)
> >>> + if (fl_discard) {
> >>> flags |= SWAP_FLAG_DISCARD;
> >>> + if (fl_discard > 1)
> >>> + flags |= SWAP_FLAG_DISCARD_CLUSTER;
> >>
> >> This is not enough, IMHO. When running this code on old kernel, swapon() return EINVAL.
> >> At that time, we should fall back swapon(0x10000).
> >
> > Hmm.. currently we don't use any fallback for any swap flag (e.g.
> > 0x10000) for compatibility with old kernels. Maybe it's better to
> > keep it simple and stupid and return an error message than introduce
> > any super-smart semantic to hide incompatible fstab configuration.
>
> Hm. If so, I'd propose to revert the following change.
>
> > .B "\-d, \-\-discard"
> >-Discard freed swap pages before they are reused, if the swap
> >-device supports the discard or trim operation. This may improve
> >-performance on some Solid State Devices, but often it does not.
> >+Enables swap discards, if the swap device supports that, and performs
> >+a batch discard operation for the swap device at swapon time.
>
>
> And instead, I suggest to make --discard-on-swapon like the following.
> (better name idea is welcome)
>
> +--discard-on-swapon
> +Enables swap discards, if the swap device supports that, and performs
> +a batch discard operation for the swap device at swapon time.
>
> I mean, preserving flags semantics removes the reason we need make a fallback.
>
>

Instead of reverting and renaming --discard, what about making it accept an
optional argument, so we could use --discard (to enable all thing and keep
backward compatibility); --discard=cluster & --discard=batch (or whatever we
think it should be named). I'll try to sort this approach out if you folks think
it's worthwhile.

-- Rafael



\
 
 \ /
  Last update: 2013-05-21 23:21    [W:0.040 / U:1.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site