Re: [PATCH/RFC] New module refcounting for net_proto_family

Max Krasnyansky
2003-02-24T19:28:57Z

At 05:01 PM 2/23/2003, Rusty Russell wrote:
>> >better know *exactly* what you are doing", even though the "try" is a
>> >bit of a misnomer.
>> Yeah, I think 'try' is definitely a misnomer in this case.
>> How about something like this ?
>
>No, I definitely want the name __try_module_get. Sure, it's a
>misnomer in one sense, which will hopefully scare off people looking
>for an easy way out. OTOH, it accurately reflects "you should be
>using try_module_get but you have special circumstances" more
>eloquently than any comment ever would. Especially since there are
>only a handful of places where it is appropriate.
>
>I think a CONFIG option for checking is overkill: better is to grep
>each kernel for __try_module_get() being added and make sure the damn
>thing doesn't spread 8)
Ok.

>+/* Sometimes we know we already have a refcount, and it's easier not
>+ to handle the error case (which only happens with rmmod --wait). */
>+static inline void __try_module_get(struct module *module)
>+{
>+ local_inc(&module->ref[get_cpu()].count);
>+ put_cpu();
>+}

I still think that __try is confusing and __module_get() would be more
appropriate name for that function. But I can live with __try_module_get() :)
I'll make new patch for net/socket.c as soon as yours goes in.

Thanks
Max