WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Use macro to walk through online cpus

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Use macro to walk through online cpus
From: Amos Waterland <apw@xxxxxxxxxx>
Date: Mon, 21 Aug 2006 23:12:24 -0400
Cc: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Delivery-date: Mon, 21 Aug 2006 20:13:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
There are two cases that I know of in xen/common where we waste cycles
walking through a list from zero to NR_CPUS.  This patch makes them use
for_each_online_cpu instead.

Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>

---

 schedule.c |    2 +-
 timer.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -r 326e6736d92b xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Aug 21 10:04:37 2006 -0400
+++ b/xen/common/schedule.c     Mon Aug 21 22:31:12 2006 -0400
@@ -633,7 +633,7 @@ void __init scheduler_init(void)
 
     open_softirq(SCHEDULE_SOFTIRQ, __enter_scheduler);
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for_each_online_cpu( i )
     {
         spin_lock_init(&per_cpu(schedule_data, i).schedule_lock);
         init_timer(&per_cpu(schedule_data, i).s_timer, s_timer_fn, NULL, i);
diff -r 326e6736d92b xen/common/timer.c
--- a/xen/common/timer.c        Mon Aug 21 10:04:37 2006 -0400
+++ b/xen/common/timer.c        Mon Aug 21 22:31:21 2006 -0400
@@ -382,7 +382,7 @@ void __init timer_init(void)
     SET_HEAP_SIZE(&dummy_heap, 0);
     SET_HEAP_LIMIT(&dummy_heap, 0);
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for_each_online_cpu( i )
     {
         spin_lock_init(&per_cpu(timers, i).lock);
         per_cpu(timers, i).heap = &dummy_heap;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>