Re: [PATCHv4 17/17] writeback: lessen sync_supers wakeup count

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

 



On Fri, 2010-05-28 at 13:29 -0700, Andrew Morton wrote:
> void mark_sb_dirty(struct super_block *sb)
> {
> 	sb->s_dirty = 1;
> 
> 	if (!supers_timer_armed) {
> 		spin_lock(&supers_timer_lock);
> 		if (!supers_timer_armed) {
> 			bdi_arm_supers_timer();
> 			supers_timer_armed = 1;
> 		}
> 	} else if (supers_timer_armed == -1)
> 		spin_lock(&supers_timer_lock);
> 		if (supers_timer_armed == -1)
> 			supers_timer_armed = 1;
> 		spin_unlock(&supers_timer_lock);
> 	}
> }
> 
> I didn't try very hard there, but you get the idea: examine the state
> before taking that expensive global spinlock, so we only end up taking
> the lock once per five seconds, rather than once per possible
> superblock dirtying.  That's like a six-orders-of-magnitude reduction
> in locking frequency, which is worth putting some effort into.

Andrew, thanks for review!

I just did not consider spinlock to be expensive because I thought that
marking superblock as dirty is a relatively rare operation. And my small
experiments kind of confirmed that.

But  Nick suggested a good locking scheme which uses only smp_mb() in
this thread, which I am going to stick with.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
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