From mboxrd@z Thu Jan 1 00:00:00 1970 From: Artem Bityutskiy Subject: Re: [PATCHv4 17/17] writeback: lessen sync_supers wakeup count Date: Sat, 29 May 2010 11:03:30 +0300 Message-ID: <1275120210.2668.11.camel@localhost.localdomain> References: <1274795352-3551-1-git-send-email-dedekind1@gmail.com> <1274795352-3551-18-git-send-email-dedekind1@gmail.com> <20100528132953.7af88c08.akpm@linux-foundation.org> Reply-To: dedekind1@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , LKML , Jens Axboe , linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from mail-fx0-f46.google.com ([209.85.161.46]:53998 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753184Ab0E2IDf (ORCPT ); Sat, 29 May 2010 04:03:35 -0400 In-Reply-To: <20100528132953.7af88c08.akpm@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, 2010-05-28 at 13:29 -0700, Andrew Morton wrote: > void mark_sb_dirty(struct super_block *sb) > { > sb->s_dirty =3D 1; >=20 > if (!supers_timer_armed) { > spin_lock(&supers_timer_lock); > if (!supers_timer_armed) { > bdi_arm_supers_timer(); > supers_timer_armed =3D 1; > } > } else if (supers_timer_armed =3D=3D -1) > spin_lock(&supers_timer_lock); > if (supers_timer_armed =3D=3D -1) > supers_timer_armed =3D 1; > spin_unlock(&supers_timer_lock); > } > } >=20 > 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 takin= g > 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 smal= l 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. --=20 Best Regards, Artem Bityutskiy (=D0=90=D1=80=D1=82=D1=91=D0=BC =D0=91=D0=B8=D1=82=D1=8E= =D1=86=D0=BA=D0=B8=D0=B9) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html