From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: Re: [PATCH] quota: Make quota stat accounting lockless. Date: Tue, 27 Apr 2010 07:54:42 +0400 Message-ID: <87aaspczy5.fsf@openvz.org> References: <87ljceka4i.fsf@openvz.org> <20100426151623.GD3673@quack.suse.cz> <20100426152407.GE3673@quack.suse.cz> <87r5m2chsv.fsf@openvz.org> <20100426173729.GG3673@quack.suse.cz> <20100426201451.GH3673@quack.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Jan Kara Return-path: Received: from mail-bw0-f219.google.com ([209.85.218.219]:50033 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753748Ab0D0Dyr (ORCPT ); Mon, 26 Apr 2010 23:54:47 -0400 Received: by bwz19 with SMTP id 19so112166bwz.21 for ; Mon, 26 Apr 2010 20:54:46 -0700 (PDT) In-Reply-To: <20100426201451.GH3673@quack.suse.cz> (Jan Kara's message of "Mon, 26 Apr 2010 22:14:51 +0200") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Jan Kara writes: > On Mon 26-04-10 19:37:29, Jan Kara wrote: >> On Mon 26-04-10 20:14:24, Dmitry Monakhov wrote: >> > Jan Kara writes: >> > >> > > On Mon 26-04-10 17:16:23, Jan Kara wrote: >> > >> On Fri 23-04-10 09:31:41, Dmitry Monakhov wrote: >> > >> > >> > >> > I've written this patch long time ago, it is pretty simple, and >> > >> > allow more non obvious locking optimization to be done later. >> > >> The patch looks OK to me. Will merge it. >> > > Hmm, maybe I spoke to soon. One question: >> > > >> > >> > +void dqstats_inc(unsigned int type) >> > >> > +{ >> > >> > +#ifdef CONFIG_SMP >> > >> > + per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++; >> > >> > +#else >> > >> > + dqstats[type]++; >> > >> > +#endif >> > >> > +} >> > >> > + >> > >> > +void dqstats_dec(unsigned int type) >> > >> > +{ >> > >> > +#ifdef CONFIG_SMP >> > >> > + per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--; >> > >> > +#else >> > >> > + dqstats[type]--; >> > >> > +#endif >> > >> > +} >> > > Why not make these two functions inline? Since they are used >> > > also from quota_tree.c and quota_v1.c, we'd need to move them to a >> > > quota.h header in that case. >> > My initial goal was to keep inc/dec/read helpers together. >> > We still need to export dqstats_pcpu. But if you prefer this style >> > i'm ok with it. New version attached. >> OK, I've merged the new version (with a few whitespace fixes). Thanks. > The patch didn't compile for !CONFIG_SMP systems and also broke > /proc/sys/fs/quota/warning file. Dmitry, could you be more careful next > time, please? I've fixed that up and tested that it actually works. > Attached is a resulting patch that I currently carry. Hmm.. i dont wat to say... it was my unpredictable laziness effect. Really sorry for wasting your time in that meaner. Will take more efforts to avoid this in future.