Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902Ab3EUVNW (ORCPT ); Tue, 21 May 2013 17:13:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742Ab3EUVNV (ORCPT ); Tue, 21 May 2013 17:13:21 -0400 Date: Tue, 21 May 2013 18:13:00 -0300 From: Rafael Aquini To: KOSAKI Motohiro Cc: Karel Zak , 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 Message-ID: <20130521211300.GE20178@optiplex.redhat.com> References: <398ace0dd3ca1283372b3aad3fceeee59f6897d7.1369084886.git.aquini@redhat.com> <519AC7B3.5060902@gmail.com> <20130521102648.GB11774@x2.net.home> <519BD640.4040102@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519BD640.4040102@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2271 Lines: 56 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/