From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761759AbXEJNMr (ORCPT ); Thu, 10 May 2007 09:12:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758245AbXEJNMl (ORCPT ); Thu, 10 May 2007 09:12:41 -0400 Received: from tomts40.bellnexxia.net ([209.226.175.97]:45807 "EHLO tomts40-srv.bellnexxia.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758674AbXEJNMk (ORCPT ); Thu, 10 May 2007 09:12:40 -0400 Date: Thu, 10 May 2007 09:12:41 -0400 From: Mathieu Desnoyers To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, hch@infradead.org, Adrian Bunk Subject: Re: [patch 02/10] Linux Kernel Markers, architecture independent code. Message-ID: <20070510131240.GD22424@Krystal> References: <20070510015555.973107048@polymtl.ca> <20070510020915.609367244@polymtl.ca> <20070510051043.GA6640@martell.zuzino.mipt.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20070510051043.GA6640@martell.zuzino.mipt.ru> X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.4.34-grsec (i686) X-Uptime: 09:12:14 up 97 days, 3:19, 5 users, load average: 2.20, 2.54, 2.60 User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Linux Kernel Markers - Architecture Independant Code fix 2 Fix trivial SMP bug in list_modules. Signed-off-by: Mathieu Desnoyers --- kernel/module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: linux-2.6-lttng/kernel/module.c =================================================================== --- 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 trace_mark(list_module, "%s %d %lu", mod->name, mod->state, refcount); -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68