lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090402110824.e0c1ec72.akpm@linux-foundation.org>
Date:	Thu, 2 Apr 2009 11:08:24 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dave Hansen <dave@...ux.vnet.ibm.com>
Cc:	npiggin@...e.de, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: Re: [patch 1/2] fs: mnt_want_write speedup

On Wed, 11 Mar 2009 15:11:17 -0700
Dave Hansen <dave@...ux.vnet.ibm.com> wrote:

> I'm feeling a bit better about these, although I am still honestly quite
> afraid of the barriers.  I also didn't like all the #ifdefs much, but
> here's some help on that.

Do we need the ifdefs at all?

> How about this on top of what you have as a bit of a cleanup?  It gets
> rid of all the new #ifdefs in .c files?
> 
> Did I miss the use of get_mnt_writers_ptr()?  I don't think I actually
> saw it used anywhere in this pair of patches, so I've stolen it.  I
> think gcc should compile all this new stuff down to be basically the
> same as you had before.  The one thing I'm not horribly sure of is the
> "out_free_devname:" label.  It shouldn't be reachable in the !SMP case. 
> 
> I could also consolidate the header #ifdefs into a single one if you
> think that looks better.
> 
> This is just compile tested, btw.  
> 
> ---
> 
>  linux-2.6.git-dave/fs/namespace.c        |   35 ++++++-------------------------
>  linux-2.6.git-dave/include/linux/mount.h |   30 ++++++++++++++++++++++++--
>  2 files changed, 35 insertions(+), 30 deletions(-)
> 
> diff -puN include/linux/mount.h~move-ifdefs-take2 include/linux/mount.h
> --- linux-2.6.git/include/linux/mount.h~move-ifdefs-take2	2009-03-11 15:01:10.000000000 -0700
> +++ linux-2.6.git-dave/include/linux/mount.h	2009-03-11 15:02:01.000000000 -0700
> @@ -71,15 +71,41 @@ struct vfsmount {
>  #endif
>  };
>  
> -static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
> +static inline int *get_mnt_writers_ptr_cpu(struct vfsmount *mnt,
> +					   int cpu)
>  {
>  #ifdef CONFIG_SMP
> -	return mnt->mnt_writers;
> +	return per_cpu_ptr(mnt->mnt_writers, cpu);
>  #else
>  	return &mnt->mnt_writers;
>  #endif
>  }
>  
> +static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
> +{
> +	return get_mnt_writers_ptr_cpu(mnt, smp_processor_id());
> +}
> +
> +static inline int alloc_mnt_writers(struct vfsmount *mnt)
> +{
> +#ifdef CONFIG_SMP
> +	mnt->mnt_writers = alloc_percpu(int);
> +	if (!mnt->mnt_writers)
> +		return -ENOMEM;
> +#else
> +	mnt->mnt_writers = 0;
> +#endif
> +	return 0;
> +}

If the CONFIG_SMP=n code is just removed, the percpu code should dtrt
with CONFIG_SMP=n.  There is the additional pointer indirection though,
I guess.  Do we do it often enough to be concerned about the cost?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ