lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 13 May 2011 13:28:59 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Tejun Heo <tj@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"cl@...ux.com" <cl@...ux.com>,
	"npiggin@...nel.dk" <npiggin@...nel.dk>
Subject: Re: [patch v2 0/5] percpu_counter: bug fix and enhancement

Hi,
On Fri, May 13, 2011 at 01:20:06PM +0800, Eric Dumazet wrote:
> Le vendredi 13 mai 2011 à 12:37 +0800, Shaohua Li a écrit :
> > On Thu, 2011-05-12 at 17:05 +0800, Tejun Heo wrote:
> > > Hello,
> > > 
> > > On Thu, May 12, 2011 at 11:02:15AM +0200, Eric Dumazet wrote:
> > > > > I don't think @maxfuzzy is necessary there.  I wrote this before but
> > > > > why can't we track the actual deviation instead of the number of
> > > > > deviation events?
> > > > 
> > > > Thats roughly same thing (BATCH multiplicator factor apart)
> > > > 
> > > > Most percpu_counter users for a given percpu_counter object use a given
> > > > BATCH, dont they ?
> > > 
> > > Well, @maxfuzzy is much harder than @batch.  It's way less intuitive.
> > > Although I haven't really thought about it that much, I think it might
> > > be possible to eliminate it.  Maybe I'm confused.  I'll take another
> > > look later but if someone can think of something, please jump right
> > > in.
> > Hmm, looks Eric's approach doesn't work. because we want to remove lock
> > in _add, checking seq in _sum still races with _add.
> > 
> 
> Why ?
> 
> I'll code a patch, I believe it should work.
I thought your proposal is:
in _add
{
	if (count >= batch || count <= -batch) {
		fbc->seq_count++;
               atomic64_add(count, &fbc->count);
-------->
                __this_cpu_write(*fbc->counters, 0);
	}
}

in _sum
{
restart:
	oldseq = fbc->seqcount;
	smp_rmb();
	do_sum();
	smp_rmb()
	newseq = fbc->seqcount;
	if (newseq - oldseq >= maxfuzzy)
		goto restart;
	return ret;
} 
if _sum run between above line marked in _add, then the seqcount check
doesn't work, we still have deviation Tejun pointed out.

Thanks,
Shaohua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ