* [PATCH] alloc uid cleanup
@ 2006-04-17 19:20 Prasanna Meda
2006-04-18 4:53 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Prasanna Meda @ 2006-04-17 19:20 UTC (permalink / raw)
To: akpm; +Cc: linux-mm
Cleanup: Release the lock before key_put methods. They call
schedule_work etc. They block interrupts now, so it is not bug fix.
Signed-off-by: Prasanna Meda
--- a/kernel/user.c 2006-04-17 23:02:54.000000000 +0530
+++ b/kernel/user.c 2006-04-17 23:06:01.000000000 +0530
@@ -160,15 +160,15 @@ struct user_struct * alloc_uid(uid_t uid
spin_lock_irq(&uidhash_lock);
up = uid_hash_find(uid, hashent);
if (up) {
+ spin_unlock_irq(&uidhash_lock);
key_put(new->uid_keyring);
key_put(new->session_keyring);
kmem_cache_free(uid_cachep, new);
} else {
uid_hash_insert(new, hashent);
up = new;
+ spin_unlock_irq (&uidhash_lock);
}
- spin_unlock_irq(&uidhash_lock);
-
}
return up;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] alloc uid cleanup
2006-04-17 19:20 [PATCH] alloc uid cleanup Prasanna Meda
@ 2006-04-18 4:53 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2006-04-18 4:53 UTC (permalink / raw)
To: Prasanna Meda; +Cc: linux-mm
Prasanna Meda <mlp@google.com> wrote:
>
> Cleanup: Release the lock before key_put methods. They call
> schedule_work etc. They block interrupts now, so it is not bug fix.
>
> Signed-off-by: Prasanna Meda
>
> --- a/kernel/user.c 2006-04-17 23:02:54.000000000 +0530
> +++ b/kernel/user.c 2006-04-17 23:06:01.000000000 +0530
> @@ -160,15 +160,15 @@ struct user_struct * alloc_uid(uid_t uid
> spin_lock_irq(&uidhash_lock);
> up = uid_hash_find(uid, hashent);
> if (up) {
> + spin_unlock_irq(&uidhash_lock);
> key_put(new->uid_keyring);
> key_put(new->session_keyring);
> kmem_cache_free(uid_cachep, new);
> } else {
> uid_hash_insert(new, hashent);
> up = new;
> + spin_unlock_irq (&uidhash_lock);
> }
> - spin_unlock_irq(&uidhash_lock);
> -
> }
> return up;
> }
The path you're optimising is the wildly-improbable
we-raced-with-someone-else one. The benefits from this patch will most
likely be outweighed by the loss of increased text size.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-18 4:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 19:20 [PATCH] alloc uid cleanup Prasanna Meda
2006-04-18 4:53 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).