lkml.org 
[lkml]   [2010]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 2/4] lglock: introduce special lglock and brlock spin locks
From
Date
Le vendredi 04 juin 2010 à 16:43 +1000, Nick Piggin a écrit :
> pièce jointe document texte brut (kernel-introduce-brlock.patch)
> This patch introduces "local-global" locks (lglocks). These can be used to:
>
> - Provide fast exclusive access to per-CPU data, with exclusive access to
> another CPU's data allowed but possibly subject to contention, and to provide
> very slow exclusive access to all per-CPU data.
> - Or to provide very fast and scalable read serialisation, and to provide
> very slow exclusive serialisation of data (not necessarily per-CPU data).
>
> Brlocks are also implemented as a short-hand notation for the latter use
> case.
>
> Thanks to Paul for local/global naming convention.
>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-fsdevel@vger.kernel.org
> Cc: Al Viro <viro@ZenIV.linux.org.uk>
> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> Cc: Frank Mayhar <fmayhar@google.com>,
> Cc: John Stultz <johnstul@us.ibm.com>
> Cc: Andi Kleen <ak@linux.intel.com>
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> ---
> include/linux/lglock.h | 165 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 165 insertions(+)
>

IMHO some changes in Documentation/ would be needed

> \
> + void name##_global_lock(void) { \
> + int i; \
> + preempt_disable(); \
> + rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
> + for_each_online_cpu(i) { \

for_each_possible_cpu()

> + arch_spinlock_t *lock; \
> + lock = &per_cpu(name##_lock, i); \
> + arch_spin_lock(lock); \
> + } \
> + } \
> + EXPORT_SYMBOL(name##_global_lock); \
> + \
> + void name##_global_unlock(void) { \
> + int i; \
> + rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
> + for_each_online_cpu(i) { \

for_each_possible_cpu()

> + arch_spinlock_t *lock; \
> + lock = &per_cpu(name##_lock, i); \
> + arch_spin_unlock(lock); \
> + } \
> + preempt_enable(); \
> + } \
> + EXPORT_SYMBOL(name##_global_unlock); \
> + \


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

\
 
 \ /
  Last update: 2010-06-04 09:59    [W:0.111 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site