From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
Rafael Aquini <aquini@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, hughd@google.com, shli@kernel.org,
jmoyer@redhat.com, riel@redhat.com, lwoodman@redhat.com,
mgorman@suse.de
Subject: Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support
Date: Tue, 21 May 2013 16:17:04 -0400 [thread overview]
Message-ID: <519BD640.4040102@gmail.com> (raw)
In-Reply-To: <20130521102648.GB11774@x2.net.home>
(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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
Rafael Aquini <aquini@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, hughd@google.com, shli@kernel.org,
jmoyer@redhat.com, riel@redhat.com, lwoodman@redhat.com,
mgorman@suse.de
Subject: Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support
Date: Tue, 21 May 2013 16:17:04 -0400 [thread overview]
Message-ID: <519BD640.4040102@gmail.com> (raw)
In-Reply-To: <20130521102648.GB11774@x2.net.home>
(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.
next prev parent reply other threads:[~2013-05-21 20:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 0:04 [RFC PATCH 00/02] swap: allowing a more flexible DISCARD policy Rafael Aquini
2013-05-21 0:04 ` Rafael Aquini
2013-05-21 0:04 ` [RFC PATCH 01/02] swap: discard while swapping only if SWAP_FLAG_DISCARD_CLUSTER Rafael Aquini
2013-05-21 0:04 ` Rafael Aquini
2013-05-21 0:55 ` KOSAKI Motohiro
2013-05-21 0:55 ` KOSAKI Motohiro
2013-05-21 21:06 ` Rafael Aquini
2013-05-21 21:06 ` Rafael Aquini
2013-05-21 0:04 ` [RFC PATCH 02/02] swapon: add "cluster-discard" support Rafael Aquini
2013-05-21 0:04 ` Rafael Aquini
2013-05-21 1:02 ` KOSAKI Motohiro
2013-05-21 1:02 ` KOSAKI Motohiro
2013-05-21 10:26 ` Karel Zak
2013-05-21 10:26 ` Karel Zak
2013-05-21 20:17 ` KOSAKI Motohiro [this message]
2013-05-21 20:17 ` KOSAKI Motohiro
2013-05-21 21:13 ` Rafael Aquini
2013-05-21 21:13 ` Rafael Aquini
2013-05-21 22:01 ` KOSAKI Motohiro
2013-05-21 22:01 ` KOSAKI Motohiro
2013-05-22 13:52 ` Jeff Moyer
2013-05-22 13:52 ` Jeff Moyer
2013-05-21 10:13 ` Karel Zak
2013-05-21 10:13 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519BD640.4040102@gmail.com \
--to=kosaki.motohiro@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=hughd@google.com \
--cc=jmoyer@redhat.com \
--cc=kzak@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lwoodman@redhat.com \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
--cc=shli@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.