Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140987
b: refs/heads/master
c: 2c7eea4
h: refs/heads/master
i:
  140985: 4dc7575
  140983: c4d94e0
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Mar 18, 2009
1 parent 1259f1c commit 4b7f760
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 18aecd362a1c991fbf5f7919ae051a77532ba2f8
refs/heads/master: 2c7eea4c62ba090b7f4583c3d7337ea0019be900
13 changes: 7 additions & 6 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ void tracing_reset_online_cpus(struct trace_array *tr)
}

#define SAVED_CMDLINES 128
#define NO_CMDLINE_MAP UINT_MAX
static unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN];
Expand All @@ -644,8 +645,8 @@ static atomic_t trace_record_cmdline_disabled __read_mostly;

static void trace_init_cmdlines(void)
{
memset(&map_pid_to_cmdline, -1, sizeof(map_pid_to_cmdline));
memset(&map_cmdline_to_pid, -1, sizeof(map_cmdline_to_pid));
memset(&map_pid_to_cmdline, NO_CMDLINE_MAP, sizeof(map_pid_to_cmdline));
memset(&map_cmdline_to_pid, NO_CMDLINE_MAP, sizeof(map_cmdline_to_pid));
cmdline_idx = 0;
}

Expand Down Expand Up @@ -753,12 +754,12 @@ static void trace_save_cmdline(struct task_struct *tsk)
return;

idx = map_pid_to_cmdline[tsk->pid];
if (idx >= SAVED_CMDLINES) {
if (idx == NO_CMDLINE_MAP) {
idx = (cmdline_idx + 1) % SAVED_CMDLINES;

map = map_cmdline_to_pid[idx];
if (map <= PID_MAX_DEFAULT)
map_pid_to_cmdline[map] = (unsigned)-1;
if (map != NO_CMDLINE_MAP)
map_pid_to_cmdline[map] = NO_CMDLINE_MAP;

map_pid_to_cmdline[tsk->pid] = idx;

Expand Down Expand Up @@ -786,7 +787,7 @@ void trace_find_cmdline(int pid, char comm[])

__raw_spin_lock(&trace_cmdline_lock);
map = map_pid_to_cmdline[pid];
if (map >= SAVED_CMDLINES)
if (map == NO_CMDLINE_MAP)
goto out;

strcpy(comm, saved_cmdlines[map]);
Expand Down

0 comments on commit 4b7f760

Please sign in to comment.