[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305682865-27111-3-git-send-email-john.stultz@linaro.org>
Date: Tue, 17 May 2011 18:41:03 -0700
From: John Stultz <john.stultz@...aro.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: John Stultz <john.stultz@...aro.org>,
Joe Perches <joe@...ches.com>, Ingo Molnar <mingo@...e.hu>,
Michal Nazarewicz <mina86@...a86.com>,
Andy Whitcroft <apw@...onical.com>,
Jiri Slaby <jirislaby@...il.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
David Rientjes <rientjes@...gle.com>,
Dave Hansen <dave@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org
Subject: [PATCH 2/4] comm: Add lock-free task->comm accessor
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@...ches.com>
CC: Ingo Molnar <mingo@...e.hu>
CC: Michal Nazarewicz <mina86@...a86.com>
CC: Andy Whitcroft <apw@...onical.com>
CC: Jiri Slaby <jirislaby@...il.com>
CC: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
CC: David Rientjes <rientjes@...gle.com>
CC: Dave Hansen <dave@...ux.vnet.ibm.com>
CC: Andrew Morton <akpm@...ux-foundation.org>
CC: linux-mm@...ck.org
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
fs/exec.c | 13 +++++++++++++
include/linux/sched.h | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index 34fa611..7e79c97 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -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;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f8a7cdf..5e3c25a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -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);
--
1.7.3.2.146.gca209
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists