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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1303112625.3981.191.camel@sli10-conroe>
Date:	Mon, 18 Apr 2011 15:43:45 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"cl@...ux.com" <cl@...ux.com>,
	"eric.dumazet@...il.com" <eric.dumazet@...il.com>
Subject: Re: [patch v3 3/3] percpu_counter: use atomic64 for counter in SMP

On Fri, 2011-04-15 at 12:15 +0800, Tejun Heo wrote:
> Hello,
> 
> On Thu, Apr 14, 2011 at 10:04:50AM +0800, shaohua.li@...el.com wrote:
> > Index: linux/lib/percpu_counter.c
> > ===================================================================
> > --- linux.orig/lib/percpu_counter.c	2011-04-14 09:53:04.000000000 +0800
> > +++ linux/lib/percpu_counter.c	2011-04-14 10:01:29.000000000 +0800
> > @@ -59,13 +59,17 @@ void percpu_counter_set(struct percpu_co
> >  {
> >  	int cpu;
> >  
> > -	spin_lock(&fbc->lock);
> > +	/*
> > +	 * Don't really need to disable preempt here, just make sure there is
> > +	 * no big latency because of preemption
> > +	 */
> > +	preempt_disable();
> >  	for_each_possible_cpu(cpu) {
> >  		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
> >  		*pcount = 0;
> >  	}
> > -	fbc->count = amount;
> > -	spin_unlock(&fbc->lock);
> > +	atomic64_set(&fbc->count, amount);
> > +	preempt_enable();
> 
> Disabling preemption here doesn't make any sense.
> percpu_counter_set() inherently requires its users to guarantee that
> no other user is modifying the percpu counter.
ha, ok.
should I still rebase the patch against Christoph's patch? Looks that
one is still not settled down.


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