Re: [RFC] add kobject to struct module

Greg KH
2003-09-11T17:27:40Z

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