Skip to content

Commit

Permalink
[PATCH] oprofile: Fix unnecessary cleverness
Browse files Browse the repository at this point in the history
nmi_create_files() in arch/i386/oprofile/nmi_int.c depends on
model->num_counters (number of performance counters) being less than 10.
While this is currently the case, it's too clever by half.

Other archs aren't quite as clever: they assume 100.  I suggest to
normalize them all to 1000.

Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: John Levon <levon@movementarian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Markus Armbruster authored and Linus Torvalds committed Jun 26, 2006
1 parent 57136ca commit 0c6856f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arch/alpha/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ op_axp_create_files(struct super_block * sb, struct dentry * root)

for (i = 0; i < model->num_counters; ++i) {
struct dentry *dir;
char buf[3];
char buf[4];

snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(sb, root, buf);
Expand Down
4 changes: 2 additions & 2 deletions arch/i386/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ static int nmi_create_files(struct super_block * sb, struct dentry * root)

for (i = 0; i < model->num_counters; ++i) {
struct dentry * dir;
char buf[2];
char buf[4];

snprintf(buf, 2, "%d", i);
snprintf(buf, sizeof(buf), "%d", i);
dir = oprofilefs_mkdir(sb, root, buf);
oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled);
oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event);
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static int op_mips_create_files(struct super_block * sb, struct dentry * root)

for (i = 0; i < model->num_counters; ++i) {
struct dentry *dir;
char buf[3];
char buf[4];

snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(sb, root, buf);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)

for (i = 0; i < model->num_counters; ++i) {
struct dentry *dir;
char buf[3];
char buf[4];

snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(sb, root, buf);
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/oprofile/op_model_sh7750.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int sh7750_perf_counter_create_files(struct super_block *sb, struct dentr

for (i = 0; i < NR_CNTRS; i++) {
struct dentry *dir;
char buf[3];
char buf[4];

snprintf(buf, sizeof(buf), "%d", i);
dir = oprofilefs_mkdir(sb, root, buf);
Expand Down

0 comments on commit 0c6856f

Please sign in to comment.