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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Friday, May 28, 2010 - 1:29 pm

On Tue, 25 May 2010 16:49:12 +0300
Artem Bityutskiy <dedekind1@gmail.com> wrote:


This thing's a bit ugly.


I suspect the spinlock could be removed if you switched to bitops:
test_and_set_bit(0, supers_timer_armed);

Ahother possibility is to nuke supers_timer_armed() and use
timer_pending(), mod_timer(), etc directly.



This looks inefficient.  Could we not do

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.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv4 00/17] kill unnecessary SB sync wake-ups, Artem Bityutskiy, (Tue May 25, 6:48 am)
[PATCHv4 01/17] VFS: introduce helpers for the s_dirty flag, Artem Bityutskiy, (Tue May 25, 6:48 am)
[PATCHv4 02/17] AFFS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:48 am)
[PATCHv4 04/17] BTRFS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:48 am)
[PATCHv4 05/17] EXOFS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 06/17] EXT2: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 07/17] EXT4: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 08/17] FAT: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 09/17] HFS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 10/17] HFSPLUS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 11/17] JFFS2: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 12/17] reiserfs: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 13/17] SYSV: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 14/17] UDF: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 15/17] UFS: do not manipulate s_dirt directly, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 16/17] VFS: rename s_dirt to s_dirty, Artem Bityutskiy, (Tue May 25, 6:49 am)
[PATCHv4 17/17] writeback: lessen sync_supers wakeup count, Artem Bityutskiy, (Tue May 25, 6:49 am)
Re: [PATCHv4 17/17] writeback: lessen sync_supers wakeup count, Andrew Morton, (Fri May 28, 1:29 pm)
Re: [PATCHv4 01/17] VFS: introduce helpers for the s_dirty ..., Artem Bityutskiy, (Sat May 29, 12:59 am)