Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Dan Aloni
On Fri, 17 Nov 2000, Francois romieu wrote: > CPU A: assume de->count = 1 (in de_put) > fs/proc/inode.c::44 if (!--de->count) { > de->count = 0 > > CPU B: (in remove_proc_entry) > fs/proc/generic.c::577 if (!de->count) > fs/proc/generic.c::578 free_proc_entry(de); > > CPU A:

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Ingo Oeser
On Fri, Nov 17, 2000 at 12:35:03AM -0800, Jacob Luna Lundberg wrote: > > atomic_dec_and_test() returns true. > > Indeed, after studying the asm in question I think I see how it ticks. > What is the reasoning behind reversing the result of the test instead of > returning the new value of the count

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Francois romieu
CPU A: assume de->count = 1 (in de_put) fs/proc/inode.c::44 if (!--de->count) { de->count = 0 CPU B: (in remove_proc_entry) fs/proc/generic.c::577 if (!de->count) fs/proc/generic.c::578 free_proc_entry(de); CPU A: (in de_put) fs/proc/inode.c::45 if (de->deleted) { <-- derefer

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Dan Aloni
On Fri, 17 Nov 2000, Jacob Luna Lundberg wrote: > On Fri, 17 Nov 2000, Dan Aloni wrote: > > If you are right, I guess put_files_struct() of kernel/exit.c would > > have cleaned files_struct everytime someones called it. > > Everywhere in the kernel, objects are freed when > > atomic_dec_and_test

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Dan Aloni
On Thu, 16 Nov 2000, Dan Aloni wrote: > On Thu, 16 Nov 2000, Linus Torvalds wrote: > > > On Thu, 16 Nov 2000, Dan Aloni wrote: > > > > > > Makes procfs use an atomic use count for dir entries, to avoid using > > > the Big kernel lock. Axboe says it looks ok. > > > > There's a race there. Look

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-17 Thread Jacob Luna Lundberg
On Fri, 17 Nov 2000, Dan Aloni wrote: > If you are right, I guess put_files_struct() of kernel/exit.c would > have cleaned files_struct everytime someones called it. > Everywhere in the kernel, objects are freed when > atomic_dec_and_test() returns true. Indeed, after studying the asm in questi

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-16 Thread Dan Aloni
On Thu, 16 Nov 2000, Jacob Luna Lundberg wrote: > > I'm not (yet) a kernel guru, so just point and laugh if I'm wrong, but... > > On Thu, 16 Nov 2000, Dan Aloni wrote: > > - if (!--de->count) { > > + if (atomic_dec_and_test(&de->count)) { > > Doesn't this reverse th

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-16 Thread Jacob Luna Lundberg
I'm not (yet) a kernel guru, so just point and laugh if I'm wrong, but... On Thu, 16 Nov 2000, Dan Aloni wrote: > - if (!--de->count) { > + if (atomic_dec_and_test(&de->count)) { Doesn't this reverse the sense of the test? -Jacob -- "My my, the cruelest lies are

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-16 Thread Dan Aloni
On Thu, 16 Nov 2000, Linus Torvalds wrote: > On Thu, 16 Nov 2000, Dan Aloni wrote: > > > > Makes procfs use an atomic use count for dir entries, to avoid using > > the Big kernel lock. Axboe says it looks ok. > > There's a race there. Look at what happens if de_put() races with > remove_proc_e

Re: [PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-16 Thread Linus Torvalds
On Thu, 16 Nov 2000, Dan Aloni wrote: > > Makes procfs use an atomic use count for dir entries, to avoid using > the Big kernel lock. Axboe says it looks ok. There's a race there. Look at what happens if de_put() races with remove_proc_entry(): we'd do free_proc_entry() twice. Not good. Leav

[PATCH (2.4)] atomic use count for proc_dir_entry

2000-11-16 Thread Dan Aloni
(against test11-pre5) Makes procfs use an atomic use count for dir entries, to avoid using the Big kernel lock. Axboe says it looks ok. --- linux/fs/proc/inode.c Wed Jun 21 17:25:17 2000 +++ linux/fs/proc/inode.c Thu Nov 16 19:09:28 2000 @@ -25,7 +25,7 @@ struct proc_dir_entry * d