All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: Tejun Heo <tj@kernel.org>
Cc: fweisbec@gmail.com, containers@lists.linux-foundation.org,
	lizf@cn.fujitsu.com, linux-kernel@vger.kernel.org,
	James Morris <jmorris@namei.org>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	linux-pm@lists.linux-foundation.org, paul@paulmenage.org,
	kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH 3/6] cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach()
Date: Thu, 25 Aug 2011 19:38:18 -0700	[thread overview]
Message-ID: <20110826023818.GC3457__11318.6635695913$1314326406$gmane$org@count0.beaverton.ibm.com> (raw)
In-Reply-To: <1314312192-26885-4-git-send-email-tj@kernel.org>

On Fri, Aug 26, 2011 at 12:43:09AM +0200, Tejun Heo wrote:
> Currently, there's no way to pass multiple tasks to cgroup_subsys
> methods necessitating the need for separate per-process and per-task
> methods.  This patch introduces cgroup_taskset which can be used to
> pass multiple tasks and their associated cgroups to cgroup_subsys
> methods.

This will be the third iterator-ish pattern in the cgroup code.
It's not your fault but it does seem a bit much to have:

	1) When we need to iterate over all tasks in the cgroup and
	don't mind holding the css set lock:
		void cgroup_iter_start(cgroup, iterator)
		task cgroup_iter_next(cgroup, iterator)
		void cgroup_iter_end(cgroup, iterator)

	2) For subsystem methods when we're iterating over a subset of
	tasks that may or may not be in the cgroup (e.g. for can_attach)
	-- use cgroup_tasksets:
		task cgroup_taskset_first(tset)
		task cgroup_taskset_next(tset)

	3) An iterator over all the tasks which doesn't hold the css set
	lock:
		struct cgroup_scanner {
			struct cgroup *cg;
			int (*test_task)(struct task_struct *p,
					struct cgroup_scanner *scan);
			void (*process_task)(struct task_struct *p,
					struct cgroup_scanner *scan);
			struct ptr_heap *heap;
			void *data;
		};
	This is only used in cpuset code so far. Are other cgroup
	patches planning on making use of it?

Is there a sane way to merge all this?

Perhaps we could drop the iterator interfaces in 1) and 2) and replace
it with:

		tset cgroup_taskset_from_cgroup(cgroup)

which would grab the css set lock to construct the tset from the given
cgroup -- essentially inlining the current iterator code into a single
function.

Of course this would eliminate the restriction that all the tasks in the
taskset are part of the same thread group; that would only be true for
those passed as parameters to the subsystem methods.

Cheers,
	-Matt Helsley

  reply	other threads:[~2011-08-26  2:38 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 22:43 [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods, take#2 Tejun Heo
2011-08-25 22:43 ` [PATCH 1/6] cgroup: subsys->attach_task() should be called after migration Tejun Heo
2011-08-25 22:43 ` Tejun Heo
2011-08-26  4:12   ` KAMEZAWA Hiroyuki
2011-08-26  4:12   ` KAMEZAWA Hiroyuki
     [not found]   ` <1314312192-26885-2-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  4:12     ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 2/6] cgroup: improve old cgroup handling in cgroup_attach_proc() Tejun Heo
2011-08-26  4:13   ` KAMEZAWA Hiroyuki
     [not found]   ` <1314312192-26885-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  4:13     ` KAMEZAWA Hiroyuki
2011-08-26  4:13   ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` Tejun Heo
2011-08-25 22:43 ` [PATCH 3/6] cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() Tejun Heo
2011-08-26  2:38   ` Matt Helsley [this message]
     [not found]   ` <1314312192-26885-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  2:38     ` Matt Helsley
2011-08-26  4:16     ` KAMEZAWA Hiroyuki
2011-08-26  2:38   ` Matt Helsley
2011-08-26  2:48     ` Matt Helsley
2011-08-26  2:48     ` Matt Helsley
2011-08-26  6:40     ` Tejun Heo
     [not found]     ` <20110826023818.GC3457-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2011-08-26  2:48       ` Matt Helsley
2011-08-26  6:40       ` Tejun Heo
2011-08-26 15:54       ` Paul Menage
2011-08-26  6:40     ` Tejun Heo
2011-08-26 15:54     ` Paul Menage
2011-08-26 15:54     ` Paul Menage
2011-08-26  4:16   ` KAMEZAWA Hiroyuki
2011-08-26  4:16   ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` Tejun Heo
2011-08-25 22:43 ` [PATCH 4/6] cgroup: don't use subsys->can_attach_task() or ->attach_task() Tejun Heo
2011-08-25 22:43 ` Tejun Heo
     [not found]   ` <1314312192-26885-5-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  4:18     ` KAMEZAWA Hiroyuki
2011-08-26  4:18   ` KAMEZAWA Hiroyuki
2011-08-26  4:18   ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 5/6] cgroup, cpuset: don't use ss->pre_attach() Tejun Heo
2011-08-25 22:43 ` Tejun Heo
     [not found]   ` <1314312192-26885-6-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  4:19     ` KAMEZAWA Hiroyuki
2011-08-26  4:19   ` KAMEZAWA Hiroyuki
2011-08-26  4:19   ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 6/6] cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task() Tejun Heo
2011-08-26  4:20   ` KAMEZAWA Hiroyuki
2011-08-26  4:20   ` KAMEZAWA Hiroyuki
2011-08-30 20:10   ` Frederic Weisbecker
2011-08-31  7:03     ` Tejun Heo
2011-08-31 13:42       ` Frederic Weisbecker
2011-08-31 13:42       ` Frederic Weisbecker
2011-09-01 11:22         ` Tejun Heo
2011-09-01 11:22         ` Tejun Heo
2011-09-01 11:22         ` Tejun Heo
     [not found]           ` <20110901112221.GA2752-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-09-01 12:58             ` Frederic Weisbecker
2011-09-01 12:58           ` Frederic Weisbecker
2011-09-01 12:58           ` Frederic Weisbecker
     [not found]       ` <20110831070313.GA29179-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2011-08-31 13:42         ` Frederic Weisbecker
     [not found]     ` <20110830201030.GC15953-oHC15RC7JGTpAmv0O++HtFaTQe2KTcn/@public.gmane.org>
2011-08-31  7:03       ` Tejun Heo
2011-08-31  7:03     ` Tejun Heo
     [not found]   ` <1314312192-26885-7-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-26  4:20     ` KAMEZAWA Hiroyuki
2011-08-30 20:10     ` Frederic Weisbecker
2011-08-30 20:10   ` Frederic Weisbecker
2011-08-25 22:43 ` Tejun Heo
     [not found] ` <1314312192-26885-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-25 22:43   ` [PATCH 1/6] cgroup: subsys->attach_task() should be called after migration Tejun Heo
2011-08-25 22:43   ` [PATCH 2/6] cgroup: improve old cgroup handling in cgroup_attach_proc() Tejun Heo
2011-08-25 22:43   ` [PATCH 3/6] cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() Tejun Heo
2011-08-25 22:43   ` [PATCH 4/6] cgroup: don't use subsys->can_attach_task() or ->attach_task() Tejun Heo
2011-08-25 22:43   ` [PATCH 5/6] cgroup, cpuset: don't use ss->pre_attach() Tejun Heo
2011-08-25 22:43   ` [PATCH 6/6] cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task() Tejun Heo
2011-08-25 22:48   ` [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods, take#2 Tejun Heo
2011-08-26  8:05   ` Li Zefan
2011-08-25 22:48 ` Tejun Heo
2011-08-25 22:48 ` Tejun Heo
2011-08-26  8:05 ` Li Zefan
2011-08-26  8:05 ` Li Zefan
2011-08-26 14:09   ` Tejun Heo
2011-08-26 14:56     ` Paul Menage
2011-08-26 14:56     ` Paul Menage
     [not found]     ` <20110826140900.GF2632-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-08-26 14:56       ` Paul Menage
2011-08-26 14:09   ` Tejun Heo
     [not found]   ` <4E5753D3.9080500-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-08-26 14:09     ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2011-08-23 22:19 [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods Tejun Heo
2011-08-23 22:19 ` [PATCH 3/6] cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() Tejun Heo
2011-08-25  0:39   ` KAMEZAWA Hiroyuki
2011-08-25  0:39   ` KAMEZAWA Hiroyuki
2011-08-25  8:20     ` Tejun Heo
2011-08-25  8:20     ` Tejun Heo
     [not found]       ` <20110825082049.GC3286-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-08-25  8:21         ` KAMEZAWA Hiroyuki
2011-08-25  8:21       ` KAMEZAWA Hiroyuki
2011-08-25  8:40         ` Tejun Heo
     [not found]         ` <20110825172140.eb34809f.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-08-25  8:40           ` Tejun Heo
2011-08-25  8:40         ` Tejun Heo
2011-08-25  8:37           ` KAMEZAWA Hiroyuki
     [not found]           ` <CAOS58YPM=cuWjAF+VJ4QJ8bnRcVtaDCVXBJCpdWg+2=2GmnKrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-25  8:37             ` KAMEZAWA Hiroyuki
2011-08-25  8:37           ` KAMEZAWA Hiroyuki
2011-08-25  8:21       ` KAMEZAWA Hiroyuki
     [not found]     ` <20110825093958.75b95bd8.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-08-25  8:20       ` Tejun Heo
2011-08-25  9:14   ` Paul Menage
2011-08-25  9:20     ` Tejun Heo
2011-08-25  9:32       ` Paul Menage
2011-08-25  9:32       ` Paul Menage
     [not found]       ` <20110825092045.GG3286-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-08-25  9:32         ` Paul Menage
     [not found]     ` <CALdu-PDAgqeRJt5vqTB9wddwz70Yn+Jf-Pb0dDKDBD_q37tHQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-25  9:20       ` Tejun Heo
2011-08-25  9:20     ` Tejun Heo
     [not found]   ` <1314138000-2049-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-25  0:39     ` KAMEZAWA Hiroyuki
2011-08-25  9:14     ` Paul Menage
2011-08-25  9:32     ` Paul Menage
2011-08-25  9:14   ` Paul Menage
2011-08-25  9:32   ` Paul Menage
2011-08-25  9:32   ` Paul Menage
     [not found] ` <1314138000-2049-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-08-23 22:19   ` Tejun Heo
2011-08-23 22:19 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20110826023818.GC3457__11318.6635695913$1314326406$gmane$org@count0.beaverton.ibm.com' \
    --to=matthltc@us.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=jmorris@namei.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=paul@paulmenage.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.