lkml.org 
[lkml]   [2003]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] add kobject to struct module
On Thu, Sep 11, 2003 at 06:18:12PM +1000, Rusty Russell wrote:
> In message <20030911062649.GA10454@kroah.com> you write:
> > On a site note, can't you just use a "struct completion" to use for your
> > waiting? Or do you need to do something special here?
>
> Hmm, *good* question. Think...
>
> Ah, it's because when someone's waiting for the reference count to hit
> zero, we wake them *every* time we decrement. With the reference
> count spread across every cpu, it's the only way:
>
> static inline void module_put(struct module *module)
> {
> if (module) {
> unsigned int cpu = get_cpu();
> local_dec(&module->ref[cpu].count);
> /* Maybe they're waiting for us to drop reference? */
> if (unlikely(!module_is_live(module)))
> wake_up_process(module->waiter);
> put_cpu();
> }
> }
>
> This doesn't really fit with a completion, unfortunately.

Ah, thanks for the explaination. Makes sense.

greg k-h
-
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: 2005-03-22 13:48    [W:0.196 / U:1.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site