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: <1276189574.2385.32.camel@mudge.jf.intel.com>
Date:	Thu, 10 Jun 2010 10:06:14 -0700
From:	Tim Chen <tim.c.chen@...ux.intel.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
	Andi Kleen <ak@...ux.intel.com>,
	Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH v2 1/2] tmpfs: Quick token library to allow scalable
 retrieval of tokens from token jar

On Wed, 2010-06-09 at 15:36 -0700, Andrew Morton wrote:

> > 
> > You need some synchronization, otherwise the accounting
> > would not be exact and you could overflow. Yes you could
> > open code it, but having it in a library is nicer.
> 
> The code doesn't have synchronisation!  qtoken_return() can modify the
> per-cpu "cache" in parallel with qtoken_avail()'s walk across the
> per-cpu "caches", yielding an inaccurate result.
> 
> This is all the same as percpu_add() executing in parallel with
> percpu_counter_sum() or percpu_counter_sum_positive().
> 
> If we cannot tolerate that inaccuracy then these patches are no good
> and we need a rethink.
> 
> If we _can_ tolerate that inaccuracy then percpu_counters can be used
> here.  And doing that is preferable to reinventing percpu_counters
> badly.
> 
> I'm just not seeing it.


The first version of the patch does a qtoken_reap_cache to reap the
tokens into pool before doing an accounting of the tokens and the token
count will be precise.  It was not done in the second version of the
patch due to objection that it may be  costly, and also the tokens count
will be fluctuating anyway.  However, qtoken_avail is not called very
often (usually caller will use qtoken_get to access the tokens and it
will not need a total accounting of the tokens). We can do it the
previous way and there will be no inaccuracies. 

Tim



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