RE: [PATCH 2/5] mm: frontswap: lazy initialization to allow tmem backends to build/run as modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Seth Jennings [mailto:sjenning@xxxxxxxxxxxxxxxxxx]
> Subject: Re: [PATCH 2/5] mm: frontswap: lazy initialization to allow tmem backends to build/run as
> modules
> 
> >  static int __init init_frontswap(void)
> >  {
> > +	int i;
> >  #ifdef CONFIG_DEBUG_FS
> >  	struct dentry *root = debugfs_create_dir("frontswap", NULL);
> >  	if (root == NULL)
> > @@ -364,6 +414,10 @@ static int __init init_frontswap(void)
> >  	debugfs_create_u64("invalidates", S_IRUGO,
> >  				root, &frontswap_invalidates);
> >  #endif
> > +	for (i = 0; i < MAX_INITIALIZABLE_SD; i++)
> > +		sds[i] = -1;
> > +
> > +	frontswap_enabled = 1;
> 
> If frontswap_enabled is going to be on all the time, then what point
> does it serve?  By extension, can all of the static inline wrappers in
> frontswap.h be done away with?

The intent of frontswap_enabled and cleancache_enabled was
to avoid the overhead of a function call at the point where
each frontswap/cleancache "hooks" is placed, using a global
variable check instead.  I'm not sure if this minor
performance tuning effort is worth preserving:  If not,
I agree frontswap_enabled and the static inline wrappers (as
well as their cleancache brethren) could be done away with **;
if worth preserving, then I think frontswap_enabled could
be set in the init method instead but the check for enabled
in the frontswap init method and the cleancache init_fs
method would need to be removed else lazy initialization
wouldn't work.

Dan

** Note to anyone that tries this:  There is a subtle but
clever hack in the wrappers suggested by Jeremy Fitzhardinge
that disables the wrappers at compile-time as well as
runtime.  IOW, make sure you test-compile both with
CONFIG_{CLEANCACHE|FRONTSWAP} _and_ with them unconfig'd.

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux