Re: [RFC] add kobject to struct module

From: Greg KH
Date: Thu Sep 11 2003 - 12:33:49 EST


On Thu, Sep 11, 2003 at 06:18:12PM +1000, Rusty Russell wrote:
> In message <20030911062649.GA10454@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/