All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, linux-mm@kvack.org,
	ngupta@vflare.org, konrad.wilk@oracle.com, minchan@kernel.org,
	fschmaus@gmail.com, andor.daam@googlemail.com,
	ilendir@googlemail.com, akpm@linux-foundation.org,
	mgorman@suse.de
Subject: Re: [PATCH 2/5] mm: frontswap: lazy initialization to allow tmem backends to build/run as modules
Date: Wed, 31 Oct 2012 19:42:53 -0200	[thread overview]
Message-ID: <50919B5D.9000100@cesarb.net> (raw)
In-Reply-To: <50915A5C.8000303@linux.vnet.ibm.com>

Em 31-10-2012 15:05, Seth Jennings escreveu:
> On 10/31/2012 10:07 AM, Dan Magenheimer wrote:
>> +#define MAX_INITIALIZABLE_SD 32
>
> MAX_INITIALIZABLE_SD should just be MAX_SWAPFILES
>
>> +static int sds[MAX_INITIALIZABLE_SD];
>
> Rather than store and array of enabled types indexed by type, why not
> an array of booleans indexed by type.  Or a bitfield if you really
> want to save space.

Since it is indexed by swap_info_struct's type, and frontswap already 
pokes directly inside the swap_info_structs, it would be even cleaner to 
use a boolean field within the swap_info_struct.

And if you are using a field within the swap_info_struct, you could 
overload the already existing frontswap_map field, which should only 
have any use if you have a frontswap module already loaded. That is, 
move the vzalloc of the frontswap_map to within frontswap's init 
function, and call it outside the swapfile_lock/swapon_mutex. This also 
has the advantage of not allocating the frontswap_map when it is not 
going to be used.

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com

--
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: Cesar Eduardo Barros <cesarb@cesarb.net>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, linux-mm@kvack.org,
	ngupta@vflare.org, konrad.wilk@oracle.com, minchan@kernel.org,
	fschmaus@gmail.com, andor.daam@googlemail.com,
	ilendir@googlemail.com, akpm@linux-foundation.org,
	mgorman@suse.de
Subject: Re: [PATCH 2/5] mm: frontswap: lazy initialization to allow tmem backends to build/run as modules
Date: Wed, 31 Oct 2012 19:42:53 -0200	[thread overview]
Message-ID: <50919B5D.9000100@cesarb.net> (raw)
In-Reply-To: <50915A5C.8000303@linux.vnet.ibm.com>

Em 31-10-2012 15:05, Seth Jennings escreveu:
> On 10/31/2012 10:07 AM, Dan Magenheimer wrote:
>> +#define MAX_INITIALIZABLE_SD 32
>
> MAX_INITIALIZABLE_SD should just be MAX_SWAPFILES
>
>> +static int sds[MAX_INITIALIZABLE_SD];
>
> Rather than store and array of enabled types indexed by type, why not
> an array of booleans indexed by type.  Or a bitfield if you really
> want to save space.

Since it is indexed by swap_info_struct's type, and frontswap already 
pokes directly inside the swap_info_structs, it would be even cleaner to 
use a boolean field within the swap_info_struct.

And if you are using a field within the swap_info_struct, you could 
overload the already existing frontswap_map field, which should only 
have any use if you have a frontswap module already loaded. That is, 
move the vzalloc of the frontswap_map to within frontswap's init 
function, and call it outside the swapfile_lock/swapon_mutex. This also 
has the advantage of not allocating the frontswap_map when it is not 
going to be used.

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com

  reply	other threads:[~2012-10-31 21:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 15:07 [PATCH 0/5] enable all tmem backends to be built and loaded as modules Dan Magenheimer
2012-10-31 15:07 ` Dan Magenheimer
2012-10-31 15:07 ` [PATCH 1/5] mm: cleancache: lazy initialization to allow tmem backends to build/run " Dan Magenheimer
2012-10-31 15:07   ` Dan Magenheimer
2012-11-02 18:29   ` Konrad Rzeszutek Wilk
2012-11-02 18:29     ` Konrad Rzeszutek Wilk
2012-10-31 15:07 ` [PATCH 2/5] mm: frontswap: " Dan Magenheimer
2012-10-31 15:07   ` Dan Magenheimer
2012-10-31 17:05   ` Seth Jennings
2012-10-31 17:05     ` Seth Jennings
2012-10-31 21:42     ` Cesar Eduardo Barros [this message]
2012-10-31 21:42       ` Cesar Eduardo Barros
2012-11-01 15:30     ` Dan Magenheimer
2012-11-01 15:30       ` Dan Magenheimer
2012-11-02 18:24       ` Konrad Rzeszutek Wilk
2012-11-02 18:24         ` Konrad Rzeszutek Wilk
2012-11-02 18:27     ` Konrad Rzeszutek Wilk
2012-11-02 18:27       ` Konrad Rzeszutek Wilk
2012-11-03  1:21       ` Bob Liu
2012-11-03  1:21         ` Bob Liu
2012-11-14 16:25         ` Konrad Rzeszutek Wilk
2012-11-14 16:25           ` Konrad Rzeszutek Wilk
2012-10-31 15:07 ` [PATCH 3/5] staging: zcache2+ramster: enable zcache2 to be built/loaded as a module Dan Magenheimer
2012-10-31 15:07   ` Dan Magenheimer
2012-11-02 18:39   ` Konrad Rzeszutek Wilk
2012-11-02 18:39     ` Konrad Rzeszutek Wilk
2012-10-31 15:07 ` [PATCH 4/5] staging: zcache2+ramster: enable ramster " Dan Magenheimer
2012-10-31 15:07   ` Dan Magenheimer
2012-10-31 15:07 ` [PATCH 5/5] xen: tmem: enable Xen tmem shim " Dan Magenheimer
2012-10-31 15:07   ` Dan Magenheimer

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=50919B5D.9000100@cesarb.net \
    --to=cesarb@cesarb.net \
    --cc=akpm@linux-foundation.org \
    --cc=andor.daam@googlemail.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=fschmaus@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilendir@googlemail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sjenning@linux.vnet.ibm.com \
    /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.