lkml.org 
[lkml]   [2006]   [Apr]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 04 Apr 2006 20:58:39 +1000
FromNick Piggin <>
SubjectRe: [PATCH] Keys: Improve usage of memory barriers and remove IRQ disablement
David Howells wrote:

> diff --git a/security/keys/key.c b/security/keys/key.c
> index 99781b7..d8a6e00 100644
> --- a/security/keys/key.c
> +++ b/security/keys/key.c
> @@ -619,6 +619,7 @@ void key_put(struct key *key)
>  	if (key) {
>  		key_check(key);
> 
> +		smp_mb__before_atomic_dec();
>  		if (atomic_dec_and_test(&key->usage))
>  			schedule_work(&key_cleanup_task);

Shouldn't be needed: Documentation/atomic_ops.txt specifies that any atomic_
which both modifies its atomic operand and returns something is to be a full
barrier before and after the operation.

This misuse occurs a few times in core code, which makes it a bit confusing.

However, I think it is nice to add a comment if these implicit barriers are
used, if the purpose is not really obvious.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

-
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: 2006-04-05 04:41    [from the cache]
©2003-2008