All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 4/5] cgroup: pass the clone_flags to the cgroup_fork_callback
       [not found]   ` <20091105202810.809650098-+lpkiSBCrgqwGcPS5fe+fxcU4LlsiAD9x8DZ0lRKBDr1ENwx4SLHqw@public.gmane.org>
@ 2009-11-06  8:21     ` Cedric Le Goater
       [not found]       ` <4AF3DC81.1010603-GANU6spQydw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Cedric Le Goater @ 2009-11-06  8:21 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Paul Menage,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On 11/05/2009 09:21 PM, Daniel Lezcano wrote:
> The fork callback is called but with just the task as parameter.
> This one is fine to retrieve the different parameters passed to
> the copy_process function but the clone_flags information is
> missing, so the hook in the cgroup won't be able to use of it.
> 
> This patch passes the clone_flags to the cgroup fork callback.
> That will be useful for a cgroup making process and thread
> accounting for example.
> 
> Signed-off-by: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
> ---
>  include/linux/cgroup.h  |    9 ++++++---
>  kernel/cgroup.c         |    4 ++--
>  kernel/cgroup_freezer.c |    3 ++-
>  kernel/fork.c           |    2 +-
>  4 files changed, 11 insertions(+), 7 deletions(-)

it lacks a small change in :

	Documentation/cgroups/cgroups.txt

same comment for the following patch :

	[patch 5/5] cgroup: call cgroup_exit with do_exit parameter

thanks,

C.

> Index: linux-2.6/include/linux/cgroup.h
> ===================================================================
> --- linux-2.6.orig/include/linux/cgroup.h
> +++ linux-2.6/include/linux/cgroup.h
> @@ -31,7 +31,8 @@ extern void cgroup_lock(void);
>  extern bool cgroup_lock_live_group(struct cgroup *cgrp);
>  extern void cgroup_unlock(void);
>  extern void cgroup_fork(struct task_struct *p);
> -extern int cgroup_fork_callbacks(struct task_struct *p);
> +extern int cgroup_fork_callbacks(struct task_struct *p,
> +				 unsigned long clone_flags);
>  extern void cgroup_post_fork(struct task_struct *p);
>  extern void cgroup_exit(struct task_struct *p);
>  extern int cgroupstats_build(struct cgroupstats *stats,
> @@ -430,7 +431,8 @@ struct cgroup_subsys {
>  	void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
>  			struct cgroup *old_cgrp, struct task_struct *tsk,
>  			bool threadgroup);
> -	int  (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
> +	int  (*fork)(struct cgroup_subsys *ss, struct task_struct *task,
> +		     unsigned long clone_flags);
>  	void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
>  	int (*populate)(struct cgroup_subsys *ss,
>  			struct cgroup *cgrp);
> @@ -569,7 +571,8 @@ unsigned short css_depth(struct cgroup_s
>  static inline int cgroup_init_early(void) { return 0; }
>  static inline int cgroup_init(void) { return 0; }
>  static inline void cgroup_fork(struct task_struct *p) {}
> -static inline int cgroup_fork_callbacks(struct task_struct *p) {}
> +static inline int cgroup_fork_callbacks(struct task_struct *p,
> +					unsigned long clone_flags) {}
>  static inline void cgroup_post_fork(struct task_struct *p) {}
>  static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
> 
> Index: linux-2.6/kernel/cgroup.c
> ===================================================================
> --- linux-2.6.orig/kernel/cgroup.c
> +++ linux-2.6/kernel/cgroup.c
> @@ -3436,7 +3436,7 @@ void cgroup_fork(struct task_struct *chi
>   * tasklist. No need to take any locks since no-one can
>   * be operating on this task.
>   */
> -int cgroup_fork_callbacks(struct task_struct *child)
> +int cgroup_fork_callbacks(struct task_struct *child, unsigned long clone_flags)
>  {
>  	int i, ret = 0;
>  	struct cgroup_subsys *ss;
> @@ -3448,7 +3448,7 @@ int cgroup_fork_callbacks(struct task_st
>  		ss = subsys[i];
>  		if (!ss->fork)
>  			continue;
> -		ret = ss->fork(ss, child);
> +		ret = ss->fork(ss, child, clone_flags);
>  		if (ret)
>  			goto out_exit;
>  	}
> Index: linux-2.6/kernel/cgroup_freezer.c
> ===================================================================
> --- linux-2.6.orig/kernel/cgroup_freezer.c
> +++ linux-2.6/kernel/cgroup_freezer.c
> @@ -193,7 +193,8 @@ static int freezer_can_attach(struct cgr
>  	return 0;
>  }
> 
> -static int freezer_fork(struct cgroup_subsys *ss, struct task_struct *task)
> +static int freezer_fork(struct cgroup_subsys *ss, struct task_struct *task,
> +			unsigned long clone_flags)
>  {
>  	struct freezer *freezer;
> 
> Index: linux-2.6/kernel/fork.c
> ===================================================================
> --- linux-2.6.orig/kernel/fork.c
> +++ linux-2.6/kernel/fork.c
> @@ -1216,7 +1216,7 @@ static struct task_struct *copy_process(
>  	/* Now that the task is set up, run cgroup callbacks if
>  	 * necessary. We need to run them before the task is visible
>  	 * on the tasklist. */
> -	retval = cgroup_fork_callbacks(p);
> +	retval = cgroup_fork_callbacks(p, clone_flags);
>  	if (retval)
>  		goto bad_fork_free_pid;
> 
> 

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

* Re: [patch 4/5] cgroup: pass the clone_flags to the cgroup_fork_callback
       [not found]       ` <4AF3DC81.1010603-GANU6spQydw@public.gmane.org>
@ 2009-11-06 10:50         ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2009-11-06 10:50 UTC (permalink / raw)
  To: Cedric Le Goater
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Daniel Lezcano, Paul Menage

Cedric Le Goater wrote:
> On 11/05/2009 09:21 PM, Daniel Lezcano wrote:
>   
>> The fork callback is called but with just the task as parameter.
>> This one is fine to retrieve the different parameters passed to
>> the copy_process function but the clone_flags information is
>> missing, so the hook in the cgroup won't be able to use of it.
>>
>> This patch passes the clone_flags to the cgroup fork callback.
>> That will be useful for a cgroup making process and thread
>> accounting for example.
>>
>> Signed-off-by: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
>> ---
>>  include/linux/cgroup.h  |    9 ++++++---
>>  kernel/cgroup.c         |    4 ++--
>>  kernel/cgroup_freezer.c |    3 ++-
>>  kernel/fork.c           |    2 +-
>>  4 files changed, 11 insertions(+), 7 deletions(-)
>>     
>
> it lacks a small change in :
>
> 	Documentation/cgroups/cgroups.txt
>
> same comment for the following patch :
>
> 	[patch 5/5] cgroup: call cgroup_exit with do_exit parameter
>   
Right, thanks Cedric.

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

end of thread, other threads:[~2009-11-06 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091105202143.180978630@mai-009101017029.toulouse-stg.fr.ibm.com>
     [not found] ` <20091105202810.809650098@mai-009101017029.toulouse-stg.fr.ibm.com>
     [not found]   ` <20091105202810.809650098-+lpkiSBCrgqwGcPS5fe+fxcU4LlsiAD9x8DZ0lRKBDr1ENwx4SLHqw@public.gmane.org>
2009-11-06  8:21     ` [patch 4/5] cgroup: pass the clone_flags to the cgroup_fork_callback Cedric Le Goater
     [not found]       ` <4AF3DC81.1010603-GANU6spQydw@public.gmane.org>
2009-11-06 10:50         ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.