lkml.org 
[lkml]   [2003]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC] New module refcounting for net_proto_family
At 12:45 AM 2/21/2003, Christoph Hellwig wrote:
>On Thu, Feb 20, 2003 at 05:17:52PM -0800, Max Krasnyansky wrote:
>> Yeah, I think 'try' is definitely be a misnomer in this case.
>> How about something like this ?
>>
>> static inline void __module_get(struct module *mod)
>> {
>> #ifdef CONFIG_MODULE_DETECT_API_VIOLATION
>> if (!module_refcount(mod))
>> __unsafe(mod);
>> #endif
>> local_inc(&mod->ref[get_cpu()].count);
>> put_cpu();
>> }
>>
>> We will be able to compile the kernel with CONFIG_MODULE_DETECT_API_VIOLATION
>> and easily find all modules that call __module_get() without holding a reference.
>
>Drop the ifdef, add and add an unlikely instead?
Well, module_refcount() is fairly expensive (loop for NR_CPUS). So I'd keep the ifdef.

Max

-
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:33    [W:0.084 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site