From: Anton Blanchard <anton@samba.org>
To: akpm@osdl.org
Cc: levon@movementarian.org, phil.el@wanadoo.fr,
linux-kernel@vger.kernel.org
Subject: [PATCH] use for_each_cpu in oprofile code
Date: Sun, 5 Sep 2004 03:44:03 +1000 [thread overview]
Message-ID: <20040904174403.GC7716@krispykreme> (raw)
Replace open coded versions with for_each_cpu()/for_each_online_cpu().
Signed-off-by: Anton Blanchard <anton@samba.org>
===== cpu_buffer.c 1.11 vs edited =====
--- 1.11/drivers/oprofile/cpu_buffer.c Fri Aug 27 16:42:56 2004
+++ edited/cpu_buffer.c Sun Sep 5 02:18:01 2004
@@ -36,11 +36,8 @@
{
int i;
- for (i = 0; i < NR_CPUS; ++i) {
- if (!cpu_online(i))
- continue;
+ for_each_online_cpu(i)
vfree(cpu_buffer[i].buffer);
- }
}
@@ -50,12 +47,9 @@
unsigned long buffer_size = fs_cpu_buffer_size;
- for (i = 0; i < NR_CPUS; ++i) {
+ for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
- if (!cpu_online(i))
- continue;
-
b->buffer = vmalloc(sizeof(struct op_sample) * buffer_size);
if (!b->buffer)
goto fail;
@@ -94,12 +88,9 @@
timers_enabled = 1;
- for (i = 0; i < NR_CPUS; ++i) {
+ for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
- if (!cpu_online(i))
- continue;
-
add_timer_on(&b->timer, i);
}
}
@@ -111,11 +102,8 @@
timers_enabled = 0;
- for (i = 0; i < NR_CPUS; ++i) {
+ for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
-
- if (!cpu_online(i))
- continue;
del_timer_sync(&b->timer);
}
===== oprofile_stats.c 1.8 vs edited =====
--- 1.8/drivers/oprofile/oprofile_stats.c Fri Aug 27 16:42:56 2004
+++ edited/oprofile_stats.c Sun Sep 5 02:15:49 2004
@@ -22,10 +22,7 @@
struct oprofile_cpu_buffer * cpu_buf;
int i;
- for (i = 0; i < NR_CPUS; ++i) {
- if (!cpu_possible(i))
- continue;
-
+ for_each_cpu(i) {
cpu_buf = &cpu_buffer[i];
cpu_buf->sample_received = 0;
cpu_buf->sample_lost_overflow = 0;
@@ -49,10 +46,7 @@
if (!dir)
return;
- for (i = 0; i < NR_CPUS; ++i) {
- if (!cpu_possible(i))
- continue;
-
+ for_each_cpu(i) {
cpu_buf = &cpu_buffer[i];
snprintf(buf, 10, "cpu%d", i);
cpudir = oprofilefs_mkdir(sb, dir, buf);
next reply other threads:[~2004-09-04 17:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-04 17:44 Anton Blanchard [this message]
2004-09-04 17:46 ` [PATCH] fix oprofile vfree warning on error Anton Blanchard
2004-09-04 17:57 ` [PATCH] Speed up oprofile buffer drain code Anton Blanchard
2004-09-05 18:26 ` John Levon
2004-09-05 14:32 ` [PATCH] fix oprofile vfree warning on error John Levon
2004-09-06 8:51 ` Anton Blanchard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040904174403.GC7716@krispykreme \
--to=anton@samba.org \
--cc=akpm@osdl.org \
--cc=levon@movementarian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phil.el@wanadoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.