lkml.org 
[lkml]   [2007]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch 02/10] Linux Kernel Markers, architecture independent code.
    On Thu, May 10, 2007 at 09:12:41AM -0400, Mathieu Desnoyers wrote:
    > Linux Kernel Markers - Architecture Independant Code fix 2
    >
    > Fix trivial SMP bug in list_modules.

    > --- linux-2.6-lttng.orig/kernel/module.c 2007-05-10 08:51:02.000000000 -0400
    > +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.000000000 -0400
    > @@ -2657,13 +2657,16 @@
    > /* Enumerate loaded modules */
    > struct list_head *i;
    > struct module *mod;
    > - unsigned long refcount = 0;
    > + unsigned long refcount;
    > + int cpu;
    >
    > mutex_lock(&module_mutex);
    > list_for_each(i, &modules) {
    > mod = list_entry(i, struct module, list);
    > + refcount = 0;
    > #ifdef CONFIG_MODULE_UNLOAD
    > - refcount = local_read(&mod->ref[0].count);
    > + for_each_online_cpu(cpu)
    > + refcount += local_read(&mod->ref[cpu].count);
    > #endif //CONFIG_MODULE_UNLOAD

    Still wrong: module_get on cpu X, cpu X hot unplugged. There is
    module_refcount() for you.

    -
    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: 2007-05-10 21:03    [W:0.021 / U:0.424 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site