public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED
@ 2008-12-01 11:29 Arun R Bharadwaj
  2008-12-01 11:36 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Arun R Bharadwaj @ 2008-12-01 11:29 UTC (permalink / raw)
  To: mingo, a.p.zijlstra; +Cc: linux-kernel, vatsa, bharata, dhaval, arun

Hi,

This patch adds uid information in sched_debug for CONFIG_USER_SCHED

Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
---
 include/linux/sched.h |    1 +
 kernel/sched.c        |   10 ++++++++++
 kernel/sched_debug.c  |    5 +++++
 kernel/user.c         |    2 ++
 4 files changed, 18 insertions(+)

Index: git-2.6/kernel/sched_debug.c
===================================================================
--- git-2.6.orig/kernel/sched_debug.c
+++ git-2.6/kernel/sched_debug.c
@@ -131,6 +131,11 @@ void print_cfs_rq(struct seq_file *m, in
 		cgroup_path(cgroup, path, sizeof(path));
 
 	SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path);
+#elif defined(CONFIG_USER_SCHED)
+	{
+		uid_t uid = cfs_rq->tg->uid;
+		SEQ_printf(m, "\ncfs_rq[%d] for UID: %u\n", cpu, uid);
+	}
 #else
 	SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
 #endif
Index: git-2.6/kernel/sched.c
===================================================================
--- git-2.6.orig/kernel/sched.c
+++ git-2.6/kernel/sched.c
@@ -261,6 +261,10 @@ struct task_group {
 	struct cgroup_subsys_state css;
 #endif
 
+#ifdef CONFIG_USER_SCHED
+	uid_t uid;
+#endif
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	/* schedulable entities of this group on each cpu */
 	struct sched_entity **se;
@@ -286,6 +290,12 @@ struct task_group {
 
 #ifdef CONFIG_USER_SCHED
 
+/* Helper function to pass uid information to create_sched_user() */
+void set_tg_uid(struct user_struct *user)
+{
+	user->tg->uid = user->uid;
+}
+
 /*
  * Root task group.
  * 	Every UID task group (including init_task_group aka UID-0) will
Index: git-2.6/kernel/user.c
===================================================================
--- git-2.6.orig/kernel/user.c
+++ git-2.6/kernel/user.c
@@ -101,6 +101,8 @@ static int sched_create_user(struct user
 	if (IS_ERR(up->tg))
 		rc = -ENOMEM;
 
+	set_tg_uid(up);
+
 	return rc;
 }
 
Index: git-2.6/include/linux/sched.h
===================================================================
--- git-2.6.orig/include/linux/sched.h
+++ git-2.6/include/linux/sched.h
@@ -2220,6 +2220,7 @@ extern void normalize_rt_tasks(void);
 extern struct task_group init_task_group;
 #ifdef CONFIG_USER_SCHED
 extern struct task_group root_task_group;
+extern void set_tg_uid(struct user_struct *user);
 #endif
 
 extern struct task_group *sched_create_group(struct task_group *parent);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED
  2008-12-01 11:29 [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED Arun R Bharadwaj
@ 2008-12-01 11:36 ` Peter Zijlstra
  2008-12-01 12:44   ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2008-12-01 11:36 UTC (permalink / raw)
  To: arun; +Cc: mingo, linux-kernel, vatsa, bharata, dhaval

On Mon, 2008-12-01 at 16:59 +0530, Arun R Bharadwaj wrote:
> Hi,
> 
> This patch adds uid information in sched_debug for CONFIG_USER_SCHED

I'd much rather have people working at removing USER_SCHED,. but sure,
the patch looks sane..


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED
  2008-12-01 11:36 ` Peter Zijlstra
@ 2008-12-01 12:44   ` Ingo Molnar
  2008-12-01 12:56     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2008-12-01 12:44 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: arun, linux-kernel, vatsa, bharata, dhaval


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Mon, 2008-12-01 at 16:59 +0530, Arun R Bharadwaj wrote:
> > Hi,
> > 
> > This patch adds uid information in sched_debug for CONFIG_USER_SCHED
> 
> I'd much rather have people working at removing USER_SCHED,. but sure,
> the patch looks sane..

ok, i have applied it to tip/sched/core.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED
  2008-12-01 12:44   ` Ingo Molnar
@ 2008-12-01 12:56     ` Ingo Molnar
  2008-12-01 15:19       ` [PATCH v2] " Arun R Bharadwaj
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2008-12-01 12:56 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: arun, linux-kernel, vatsa, bharata, dhaval


* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> 
> > On Mon, 2008-12-01 at 16:59 +0530, Arun R Bharadwaj wrote:
> > > Hi,
> > > 
> > > This patch adds uid information in sched_debug for CONFIG_USER_SCHED
> > 
> > I'd much rather have people working at removing USER_SCHED,. but sure,
> > the patch looks sane..
> 
> ok, i have applied it to tip/sched/core.

it doesnt build:

 kernel/sched_debug.c: In function 'print_cfs_rq':
 kernel/sched_debug.c:165: error: 'struct cfs_rq' has no member named 'tg'

please send v2 patch.

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] sched: add uid information to sched_debug for CONFIG_USER_SCHED
  2008-12-01 12:56     ` Ingo Molnar
@ 2008-12-01 15:19       ` Arun R Bharadwaj
  2008-12-01 19:40         ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Arun R Bharadwaj @ 2008-12-01 15:19 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, vatsa, bharata, dhaval

* Ingo Molnar <mingo@elte.hu> [2008-12-01 13:56:28]:

> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > 
> > * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > 
> > > On Mon, 2008-12-01 at 16:59 +0530, Arun R Bharadwaj wrote:
> > > > Hi,
> > > > 
> > > > This patch adds uid information in sched_debug for CONFIG_USER_SCHED
> > > 
> > > I'd much rather have people working at removing USER_SCHED,. but sure,
> > > the patch looks sane..
> > 
> > ok, i have applied it to tip/sched/core.
> 
> it doesnt build:
> 
>  kernel/sched_debug.c: In function 'print_cfs_rq':
>  kernel/sched_debug.c:165: error: 'struct cfs_rq' has no member named 'tg'
> 
> please send v2 patch.
> 
> Ingo

Hi Ingo,

I've posted v2 of the patch.
Had missed an '&& #if defined(CONFIG_FAIR_GROUP_SCHED)' last time
around.

--arun


This patch adds uid information in sched_debug for CONFIG_USER_SCHED

Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
---
 include/linux/sched.h |    1 +
 kernel/sched.c        |   10 ++++++++++
 kernel/sched_debug.c  |    6 +++++-
 kernel/user.c         |    2 ++
 4 files changed, 18 insertions(+), 1 deletion(-)

Index: git-2.6/kernel/sched_debug.c
===================================================================
--- git-2.6.orig/kernel/sched_debug.c
+++ git-2.6/kernel/sched_debug.c
@@ -131,10 +131,14 @@ void print_cfs_rq(struct seq_file *m, in
 		cgroup_path(cgroup, path, sizeof(path));
 
 	SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path);
+#elif defined(CONFIG_USER_SCHED) && defined(CONFIG_FAIR_GROUP_SCHED)
+	{
+		uid_t uid = cfs_rq->tg->uid;
+		SEQ_printf(m, "\ncfs_rq[%d] for UID: %u\n", cpu, uid);
+	}
 #else
 	SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
 #endif
-
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "exec_clock",
 			SPLIT_NS(cfs_rq->exec_clock));
 
Index: git-2.6/kernel/sched.c
===================================================================
--- git-2.6.orig/kernel/sched.c
+++ git-2.6/kernel/sched.c
@@ -261,6 +261,10 @@ struct task_group {
 	struct cgroup_subsys_state css;
 #endif
 
+#ifdef CONFIG_USER_SCHED
+	uid_t uid;
+#endif
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	/* schedulable entities of this group on each cpu */
 	struct sched_entity **se;
@@ -286,6 +290,12 @@ struct task_group {
 
 #ifdef CONFIG_USER_SCHED
 
+/* Helper function to pass uid information to create_sched_user() */
+void set_tg_uid(struct user_struct *user)
+{
+	user->tg->uid = user->uid;
+}
+
 /*
  * Root task group.
  * 	Every UID task group (including init_task_group aka UID-0) will
Index: git-2.6/kernel/user.c
===================================================================
--- git-2.6.orig/kernel/user.c
+++ git-2.6/kernel/user.c
@@ -101,6 +101,8 @@ static int sched_create_user(struct user
 	if (IS_ERR(up->tg))
 		rc = -ENOMEM;
 
+	set_tg_uid(up);
+
 	return rc;
 }
 
Index: git-2.6/include/linux/sched.h
===================================================================
--- git-2.6.orig/include/linux/sched.h
+++ git-2.6/include/linux/sched.h
@@ -2220,6 +2220,7 @@ extern void normalize_rt_tasks(void);
 extern struct task_group init_task_group;
 #ifdef CONFIG_USER_SCHED
 extern struct task_group root_task_group;
+extern void set_tg_uid(struct user_struct *user);
 #endif
 
 extern struct task_group *sched_create_group(struct task_group *parent);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] sched: add uid information to sched_debug for CONFIG_USER_SCHED
  2008-12-01 15:19       ` [PATCH v2] " Arun R Bharadwaj
@ 2008-12-01 19:40         ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-12-01 19:40 UTC (permalink / raw)
  To: Peter Zijlstra, linux-kernel, vatsa, bharata, dhaval


* Arun R Bharadwaj <arun@linux.vnet.ibm.com> wrote:

> * Ingo Molnar <mingo@elte.hu> [2008-12-01 13:56:28]:
> 
> > 
> > * Ingo Molnar <mingo@elte.hu> wrote:
> > 
> > > 
> > > * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > > 
> > > > On Mon, 2008-12-01 at 16:59 +0530, Arun R Bharadwaj wrote:
> > > > > Hi,
> > > > > 
> > > > > This patch adds uid information in sched_debug for CONFIG_USER_SCHED
> > > > 
> > > > I'd much rather have people working at removing USER_SCHED,. but sure,
> > > > the patch looks sane..
> > > 
> > > ok, i have applied it to tip/sched/core.
> > 
> > it doesnt build:
> > 
> >  kernel/sched_debug.c: In function 'print_cfs_rq':
> >  kernel/sched_debug.c:165: error: 'struct cfs_rq' has no member named 'tg'
> > 
> > please send v2 patch.
> > 
> > Ingo
> 
> Hi Ingo,
> 
> I've posted v2 of the patch.
> Had missed an '&& #if defined(CONFIG_FAIR_GROUP_SCHED)' last time
> around.

applied, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-12-01 19:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 11:29 [PATCH] sched: add uid information to sched_debug for CONFIG_USER_SCHED Arun R Bharadwaj
2008-12-01 11:36 ` Peter Zijlstra
2008-12-01 12:44   ` Ingo Molnar
2008-12-01 12:56     ` Ingo Molnar
2008-12-01 15:19       ` [PATCH v2] " Arun R Bharadwaj
2008-12-01 19:40         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox