1. 05 Jan, 2012 1 commit
    • Li Zefan's avatar
      cgroup: fix to allow mounting a hierarchy by name · 0d19ea86
      Li Zefan authored
      If we mount a hierarchy with a specified name, the name is unique,
      and we can use it to mount the hierarchy without specifying its
      set of subsystem names. This feature is documented is
      Documentation/cgroups/cgroups.txt section 2.3
      
      Here's an example:
      
      	# mount -t cgroup -o cpuset,name=myhier xxx /cgroup1
      	# mount -t cgroup -o name=myhier xxx /cgroup2
      
      But it was broken by commit 32a8cf23
      (cgroup: make the mount options parsing more accurate)
      
      This fixes the regression.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      0d19ea86
  2. 04 Jan, 2012 1 commit
  3. 27 Dec, 2011 3 commits
  4. 22 Dec, 2011 3 commits
  5. 21 Dec, 2011 2 commits
  6. 19 Dec, 2011 1 commit
  7. 13 Dec, 2011 10 commits
    • Davidlohr Bueso's avatar
      resource cgroups: remove bogus cast · 52dcf8a1
      Davidlohr Bueso authored
      The memparse() function already accepts const char * as the parsing string.
      Signed-off-by: default avatarDavidlohr Bueso <dave@gnu.org>
      Acked-by: default avatarPavel Emelyanov <xemul@parallels.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      52dcf8a1
    • Tejun Heo's avatar
      cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task() · 494c167c
      Tejun Heo authored
      These three methods are no longer used.  Kill them.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarPaul Menage <paul@paulmenage.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      494c167c
    • Tejun Heo's avatar
      cgroup, cpuset: don't use ss->pre_attach() · 94196f51
      Tejun Heo authored
      ->pre_attach() is supposed to be called before migration, which is
      observed during process migration but task migration does it the other
      way around.  The only ->pre_attach() user is cpuset which can do the
      same operaitons in ->can_attach().  Collapse cpuset_pre_attach() into
      cpuset_can_attach().
      
      -v2: Patch contamination from later patch removed.  Spotted by Paul
           Menage.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarPaul Menage <paul@paulmenage.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      94196f51
    • Tejun Heo's avatar
      cgroup: don't use subsys->can_attach_task() or ->attach_task() · bb9d97b6
      Tejun Heo authored
      Now that subsys->can_attach() and attach() take @tset instead of
      @task, they can handle per-task operations.  Convert
      ->can_attach_task() and ->attach_task() users to use ->can_attach()
      and attach() instead.  Most converions are straight-forward.
      Noteworthy changes are,
      
      * In cgroup_freezer, remove unnecessary NULL assignments to unused
        methods.  It's useless and very prone to get out of sync, which
        already happened.
      
      * In cpuset, PF_THREAD_BOUND test is checked for each task.  This
        doesn't make any practical difference but is conceptually cleaner.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Paul Menage <paul@paulmenage.org>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
      Cc: James Morris <jmorris@namei.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      bb9d97b6
    • Tejun Heo's avatar
      cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() · 2f7ee569
      Tejun Heo authored
      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.
      
      Three methods - can_attach(), cancel_attach() and attach() - are
      converted to use cgroup_taskset.  This unifies passed parameters so
      that all methods have access to all information.  Conversions in this
      patchset are identical and don't introduce any behavior change.
      
      -v2: documentation updated as per Paul Menage's suggestion.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarPaul Menage <paul@paulmenage.org>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: James Morris <jmorris@namei.org>
      2f7ee569
    • Tejun Heo's avatar
      cgroup: improve old cgroup handling in cgroup_attach_proc() · 134d3373
      Tejun Heo authored
      cgroup_attach_proc() behaves differently from cgroup_attach_task() in
      the following aspects.
      
      * All hooks are invoked even if no task is actually being moved.
      
      * ->can_attach_task() is called for all tasks in the group whether the
        new cgrp is different from the current cgrp or not; however,
        ->attach_task() is skipped if new equals new.  This makes the calls
        asymmetric.
      
      This patch improves old cgroup handling in cgroup_attach_proc() by
      looking up the current cgroup at the head, recording it in the flex
      array along with the task itself, and using it to remove the above two
      differences.  This will also ease further changes.
      
      -v2: nr_todo renamed to nr_migrating_tasks as per Paul Menage's
           suggestion.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarPaul Menage <paul@paulmenage.org>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      134d3373
    • Tejun Heo's avatar
      cgroup: always lock threadgroup during migration · cd3d0952
      Tejun Heo authored
      Update cgroup to take advantage of the fack that threadgroup_lock()
      guarantees stable threadgroup.
      
      * Lock threadgroup even if the target is a single task.  This
        guarantees that when the target tasks stay stable during migration
        regardless of the target type.
      
      * Remove PF_EXITING early exit optimization from attach_task_by_pid()
        and check it in cgroup_task_migrate() instead.  The optimization was
        for rather cold path to begin with and PF_EXITING state can be
        trusted throughout migration by checking it after locking
        threadgroup.
      
      * Don't add PF_EXITING tasks to target task array in
        cgroup_attach_proc().  This ensures that task migration is performed
        only for live tasks.
      
      * Remove -ESRCH failure path from cgroup_task_migrate().  With the
        above changes, it's guaranteed to be called only for live tasks.
      
      After the changes, only live tasks are migrated and they're guaranteed
      to stay alive until migration is complete.  This removes problems
      caused by exec and exit racing against cgroup migration including
      symmetry among cgroup attach methods and different cgroup methods
      racing each other.
      
      v2: Oleg pointed out that one more PF_EXITING check can be removed
          from cgroup_attach_proc().  Removed.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Paul Menage <paul@paulmenage.org>
      cd3d0952
    • Tejun Heo's avatar
      threadgroup: extend threadgroup_lock() to cover exit and exec · 77e4ef99
      Tejun Heo authored
      threadgroup_lock() protected only protected against new addition to
      the threadgroup, which was inherently somewhat incomplete and
      problematic for its only user cgroup.  On-going migration could race
      against exec and exit leading to interesting problems - the symmetry
      between various attach methods, task exiting during method execution,
      ->exit() racing against attach methods, migrating task switching basic
      properties during exec and so on.
      
      This patch extends threadgroup_lock() such that it protects against
      all three threadgroup altering operations - fork, exit and exec.  For
      exit, threadgroup_change_begin/end() calls are added to exit_signals
      around assertion of PF_EXITING.  For exec, threadgroup_[un]lock() are
      updated to also grab and release cred_guard_mutex.
      
      With this change, threadgroup_lock() guarantees that the target
      threadgroup will remain stable - no new task will be added, no new
      PF_EXITING will be set and exec won't happen.
      
      The next patch will update cgroup so that it can take full advantage
      of this change.
      
      -v2: beefed up comment as suggested by Frederic.
      
      -v3: narrowed scope of protection in exit path as suggested by
           Frederic.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Paul Menage <paul@paulmenage.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      77e4ef99
    • Tejun Heo's avatar
      threadgroup: rename signal->threadgroup_fork_lock to ->group_rwsem · 257058ae
      Tejun Heo authored
      Make the following renames to prepare for extension of threadgroup
      locking.
      
      * s/signal->threadgroup_fork_lock/signal->group_rwsem/
      * s/threadgroup_fork_read_lock()/threadgroup_change_begin()/
      * s/threadgroup_fork_read_unlock()/threadgroup_change_end()/
      * s/threadgroup_fork_write_lock()/threadgroup_lock()/
      * s/threadgroup_fork_write_unlock()/threadgroup_unlock()/
      
      This patch doesn't cause any behavior change.
      
      -v2: Rename threadgroup_change_done() to threadgroup_change_end() per
           KAMEZAWA's suggestion.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Paul Menage <paul@paulmenage.org>
      257058ae
    • Tejun Heo's avatar
      cgroup: add cgroup_root_mutex · e25e2cbb
      Tejun Heo authored
      cgroup wants to make threadgroup stable while modifying cgroup
      hierarchies which will introduce locking dependency on
      cred_guard_mutex from cgroup_mutex.  This unfortunately completes
      circular dependency.
      
       A. cgroup_mutex -> cred_guard_mutex -> s_type->i_mutex_key -> namespace_sem
       B. namespace_sem -> cgroup_mutex
      
      B is from cgroup_show_options() and this patch breaks it by
      introducing another mutex cgroup_root_mutex which nests inside
      cgroup_mutex and protects cgroupfs_root.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      e25e2cbb
  8. 08 Dec, 2011 1 commit
  9. 06 Dec, 2011 1 commit
  10. 24 Nov, 2011 1 commit
  11. 23 Nov, 2011 15 commits
  12. 22 Nov, 2011 1 commit
    • Linus Torvalds's avatar
      Revert "of/irq: of_irq_find_parent: check for parent equal to child" · b4bbb029
      Linus Torvalds authored
      This reverts commit dc937280.
      
      As requested by Ben Herrenschmidt:
        "This breaks some powerpc platforms at least.  The practice of having
         a node provide an explicit "interrupt-parent" property pointing to
         itself is an old trick that we've used in the past to allow a
         device-node to have interrupts routed to different controllers.
      
         In that case, the node also contains an interrupt-map, so the node is
         its own parent, the interrupt resolution hits the map, which then can
         route each individual interrupt to a different parent."
      
      Grant says:
        "Ah, nuts, yes that is broken then.  Yes, please revert the commit and
         Rob & I will come up with a better solution.
      
         Rob, I think it can be done by explicitly checking for np ==
         desc->interrupt_parent in of_irq_init() instead of relying on
         of_irq_find_parent() returning NULL."
      Requested-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: devicetree-discuss@lists.ozlabs.org
      Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
      Cc: Tanmay Inamdar <tinamdar@apm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b4bbb029