@@ -996,6 +996,19 @@ static void flush_old_files(struct files_struct * files)
spin_unlock(&files->file_lock);
}
+/**
+ * __get_task_comm - Unlocked accessor to task comm value
+ *
+ * This function returns the task->comm value without
+ * taking the comm_lock. This method is only for performance
+ * critical paths, and may return a null or incomplete comm
+ * value.
+ */
+char *__get_task_comm(struct task_struct *tsk)
+{
+ return tsk->comm;
+}
+
char *get_task_comm(char *buf, struct task_struct *tsk)
{
unsigned long flags;
@@ -2189,6 +2189,7 @@ struct task_struct *fork_idle(int);
extern void set_task_comm(struct task_struct *tsk, char *from);
extern char *get_task_comm(char *to, struct task_struct *tsk);
+extern char *__get_task_comm(struct task_struct *tsk);
#ifdef CONFIG_SMP
extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
This patch adds __get_task_comm() which returns the task->comm value without taking the comm_lock. This function may return null or incomplete comm values, and is only present for performance critical paths that can handle these pitfalls. CC: Joe Perches <joe@perches.com> CC: Ingo Molnar <mingo@elte.hu> CC: Michal Nazarewicz <mina86@mina86.com> CC: Andy Whitcroft <apw@canonical.com> CC: Jiri Slaby <jirislaby@gmail.com> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> CC: David Rientjes <rientjes@google.com> CC: Dave Hansen <dave@linux.vnet.ibm.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: linux-mm@kvack.org Signed-off-by: John Stultz <john.stultz@linaro.org> --- fs/exec.c | 13 +++++++++++++ include/linux/sched.h | 1 + 2 files changed, 14 insertions(+), 0 deletions(-)