Re: [RFC] add kobject to struct module

From: Rusty Russell (rusty_at_rustcorp.com.au)
Date: 09/11/03

  • Next message: Jens Axboe: "Re: ide-scsi oops was: 2.6.0-test4-mm3"
    To: Greg KH <greg@kroah.com>
    Date:	Thu, 11 Sep 2003 18:18:12 +1000
    
    

    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.

    > > 1) Adopt a faster, smaller implementation of alloc_percpu (this patch
    > > exists, needs some arch-dependent love for ia64).
    > > 2) Use it to generalize the current module reference count scheme to
    > > a "bigref_t" (I have a couple of these)
    > > 3) Use that in kobjects.
    >
    > Hm, I don't know if kobjects really need to get that heavy.

    I'm not sure either: really depends on kobject usage. I was thinking
    struct netdevice. The size for UP is the same, the size for SMP is
    ptr + sizeof(int) + sizeof(atomic_t)*NR_CPUs.

    > But yes, that's all 2.7 dreams :)

    Cheers,
    Rusty.

    --
      Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
    -
    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/
    

  • Next message: Jens Axboe: "Re: ide-scsi oops was: 2.6.0-test4-mm3"

    Relevant Pages