tracing: Revert commits improving handling of saved_tgids
This reverts commit7005c6eec7
("tracing: Free saved_tgids memory in free_saved_cmdlines_buffer") and commitbe0b454d52
("tracing: Modify saved_tgids size for change in saved_cmdline_size") An upstream patch is now available that does the same thing and handles additional cases as well. Change-Id: I05cf2dc566a6425e58076ae2e9698335b6d738cc Signed-off-by: Dennis Cagle <dcagle@codeaurora.org>
This commit is contained in:
parent
a49bb61510
commit
3fe1011f7e
1 changed files with 5 additions and 16 deletions
|
@ -1358,11 +1358,11 @@ void tracing_reset_all_online_cpus(void)
|
|||
|
||||
#define SAVED_CMDLINES_DEFAULT 128
|
||||
#define NO_CMDLINE_MAP UINT_MAX
|
||||
static unsigned saved_tgids[SAVED_CMDLINES_DEFAULT];
|
||||
static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED;
|
||||
struct saved_cmdlines_buffer {
|
||||
unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
|
||||
unsigned *map_cmdline_to_pid;
|
||||
unsigned *saved_tgids;
|
||||
unsigned cmdline_num;
|
||||
int cmdline_idx;
|
||||
char *saved_cmdlines;
|
||||
|
@ -1396,22 +1396,12 @@ static int allocate_cmdlines_buffer(unsigned int val,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
s->saved_tgids = kmalloc_array(val, sizeof(*s->saved_tgids),
|
||||
GFP_KERNEL);
|
||||
if (!s->saved_tgids) {
|
||||
kfree(s->map_cmdline_to_pid);
|
||||
kfree(s->saved_cmdlines);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
s->cmdline_idx = 0;
|
||||
s->cmdline_num = val;
|
||||
memset(&s->map_pid_to_cmdline, NO_CMDLINE_MAP,
|
||||
sizeof(s->map_pid_to_cmdline));
|
||||
memset(s->map_cmdline_to_pid, NO_CMDLINE_MAP,
|
||||
val * sizeof(*s->map_cmdline_to_pid));
|
||||
memset(s->saved_tgids, 0,
|
||||
val * sizeof(*s->saved_tgids));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1607,7 +1597,7 @@ static int trace_save_cmdline(struct task_struct *tsk)
|
|||
}
|
||||
|
||||
set_cmdline(idx, tsk->comm);
|
||||
savedcmd->saved_tgids[idx] = tsk->tgid;
|
||||
saved_tgids[idx] = tsk->tgid;
|
||||
arch_spin_unlock(&trace_cmdline_lock);
|
||||
|
||||
return 1;
|
||||
|
@ -1659,7 +1649,7 @@ int trace_find_tgid(int pid)
|
|||
arch_spin_lock(&trace_cmdline_lock);
|
||||
map = savedcmd->map_pid_to_cmdline[pid];
|
||||
if (map != NO_CMDLINE_MAP)
|
||||
tgid = savedcmd->saved_tgids[map];
|
||||
tgid = saved_tgids[map];
|
||||
else
|
||||
tgid = -1;
|
||||
|
||||
|
@ -3991,7 +3981,6 @@ static void free_saved_cmdlines_buffer(struct saved_cmdlines_buffer *s)
|
|||
{
|
||||
kfree(s->saved_cmdlines);
|
||||
kfree(s->map_cmdline_to_pid);
|
||||
kfree(s->saved_tgids);
|
||||
kfree(s);
|
||||
}
|
||||
|
||||
|
@ -4233,13 +4222,13 @@ tracing_saved_tgids_read(struct file *file, char __user *ubuf,
|
|||
int pid;
|
||||
int i;
|
||||
|
||||
file_buf = kmalloc(savedcmd->cmdline_num*(16+1+16), GFP_KERNEL);
|
||||
file_buf = kmalloc(SAVED_CMDLINES_DEFAULT*(16+1+16), GFP_KERNEL);
|
||||
if (!file_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
buf = file_buf;
|
||||
|
||||
for (i = 0; i < savedcmd->cmdline_num; i++) {
|
||||
for (i = 0; i < SAVED_CMDLINES_DEFAULT; i++) {
|
||||
int tgid;
|
||||
int r;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue