Re: [patch 02/27] fs: scale files_lock

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

 



On Sat, Apr 25, 2009 at 11:20:22AM +1000, npiggin@xxxxxxx wrote:
> Improve scalability of files_lock by adding per-cpu, per-sb files lists,
> protected with per-cpu locking. Effectively turning it into a big-writer
> lock.

Og dumb.  Many locks.  Many ifdefs.  Og don't like.

>  void file_sb_list_add(struct file *file, struct super_block *sb)
>  {
> -	spin_lock(&files_lock);
> +	spinlock_t *lock;
> +	struct list_head *list;
> +	int cpu;
> +
> +	lock = &get_cpu_var(files_cpulock);
> +#ifdef CONFIG_SMP
> +	BUG_ON(file->f_sb_list_cpu != -1);
> +	cpu = smp_processor_id();
> +	list = per_cpu_ptr(sb->s_files, cpu);
> +	file->f_sb_list_cpu = cpu;
> +#else
> +	list = &sb->s_files;
> +#endif
> +	spin_lock(lock);
>  	BUG_ON(!list_empty(&file->f_u.fu_list));
> -	list_add(&file->f_u.fu_list, &sb->s_files);
> -	spin_unlock(&files_lock);
> +	list_add(&file->f_u.fu_list, list);
> +	spin_unlock(lock);
> +	put_cpu_var(files_cpulock);
>  }

Don't like overhead on hot paths either.

And grown memory footprint of struct super_block (with alloc_percpu())

>  	atomic_long_t		f_count;
>  	unsigned int 		f_flags;
>  	fmode_t			f_mode;
> @@ -1330,7 +1333,11 @@ struct super_block {
>  	struct list_head	s_io;		/* parked for writeback */
>  	struct list_head	s_more_io;	/* parked for more writeback */
>  	struct hlist_head	s_anon;		/* anonymous dentries for (nfs) exporting */
> +#ifdef CONFIG_SMP
> +	struct list_head	*s_files;
> +#else
>  	struct list_head	s_files;
> +#endif
>  	/* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
>  	struct list_head	s_dentry_lru;	/* unused dentry lru */
>  	int			s_nr_dentry_unused;	/* # of dentry on lru */

... and ifdefs like that in structs.

What I really want to see is a rationale for all that.  Preferably with
more than microbenchmarks showing a visible impact.

Especially if you compare it with alternative variant that simply splits
files_lock on per-sb basis.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux