1. 13 12月, 2011 8 次提交
    • T
      cgroup, cpuset: don't use ss->pre_attach() · 94196f51
      Tejun Heo 提交于
      ->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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NPaul Menage <paul@paulmenage.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      94196f51
    • T
      cgroup: don't use subsys->can_attach_task() or ->attach_task() · bb9d97b6
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NLi 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
    • T
      cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() · 2f7ee569
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NPaul Menage <paul@paulmenage.org>
      Acked-by: NLi 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
    • T
      cgroup: improve old cgroup handling in cgroup_attach_proc() · 134d3373
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NPaul Menage <paul@paulmenage.org>
      Acked-by: NLi Zefan <lizf@cn.fujitsu.com>
      134d3373
    • T
      cgroup: always lock threadgroup during migration · cd3d0952
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NLi 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
    • T
      threadgroup: extend threadgroup_lock() to cover exit and exec · 77e4ef99
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NFrederic 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
    • T
      threadgroup: rename signal->threadgroup_fork_lock to ->group_rwsem · 257058ae
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: NLi 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
    • T
      cgroup: add cgroup_root_mutex · e25e2cbb
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      e25e2cbb
  2. 09 12月, 2011 1 次提交
  3. 07 12月, 2011 1 次提交
  4. 25 11月, 2011 1 次提交
  5. 24 11月, 2011 9 次提交
    • R
      Merge branch 'pm-freezer' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into pm-freezer · 986b11c3
      Rafael J. Wysocki 提交于
      * 'pm-freezer' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc: (24 commits)
        freezer: fix wait_event_freezable/__thaw_task races
        freezer: kill unused set_freezable_with_signal()
        dmatest: don't use set_freezable_with_signal()
        usb_storage: don't use set_freezable_with_signal()
        freezer: remove unused @sig_only from freeze_task()
        freezer: use lock_task_sighand() in fake_signal_wake_up()
        freezer: restructure __refrigerator()
        freezer: fix set_freezable[_with_signal]() race
        freezer: remove should_send_signal() and update frozen()
        freezer: remove now unused TIF_FREEZE
        freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE
        cgroup_freezer: prepare for removal of TIF_FREEZE
        freezer: clean up freeze_processes() failure path
        freezer: kill PF_FREEZING
        freezer: test freezable conditions while holding freezer_lock
        freezer: make freezing indicate freeze condition in effect
        freezer: use dedicated lock instead of task_lock() + memory barrier
        freezer: don't distinguish nosig tasks on thaw
        freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks
        freezer: rename thaw_process() to __thaw_task() and simplify the implementation
        ...
      986b11c3
    • R
      PM / Hibernate: Do not leak memory in error/test code paths · bb58dd5d
      Rafael J. Wysocki 提交于
      The hibernation core code forgets to release memory preallocated
      for hibernation if there's an error in its early stages or if test
      modes causing hibernation_snapshot() to return early are used.  This
      causes the system to be hardly usable, because the amount of
      preallocated memory is usually huge.  Fix this problem.
      Reported-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      bb58dd5d
    • L
      f10cdea6
    • L
      Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging · 5907c5f8
      Linus Torvalds 提交于
      * 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
        i2c: Make i2cdev_notifier_call static
        i2c: Delete ANY_I2C_BUS
        i2c: Fix device name for 10-bit slave address
        i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
      5907c5f8
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 0a2c9865
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: TPS65910: Fix VDD1/2 voltage selector count
      0a2c9865
    • L
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 2d0f2400
      Linus Torvalds 提交于
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (31 commits)
        drm: integer overflow in drm_mode_dirtyfb_ioctl()
        drivers/gpu/vga/vgaarb.c: add missing kfree
        drm/radeon/kms/atom: unify i2c gpio table handling
        drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real
        ttm: Don't return the bo reserved on error path
        drm/radeon/kms: add a CS ioctl flag not to rewrite tiling flags in the CS
        drm/i915: Fix inconsistent backlight level during disabled
        drm, i915: Fix memory leak in i915_gem_busy_ioctl().
        drm/i915: Use DPCD value for max DP lanes.
        drm/i915: Initiate DP link training only on the lanes we'll be using
        drm/i915: Remove trailing white space
        drm/i915: Try harder during dp pattern 1 link training
        drm/i915: Make DP prepare/commit consistent with DP dpms
        drm/i915: Let panel power sequencing hardware do its job
        drm/i915: Treat PCH eDP like DP in most places
        drm/i915: Remove link_status field from intel_dp structure
        drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control
        drm/i915: Module parameters using '-1' as default must be signed type
        drm/i915: Turn on another required clock gating bit on gen6.
        drm/i915: Turn on a required 3D clock gating bit on Sandybridge.
        ...
      2d0f2400
    • O
      freezer: fix wait_event_freezable/__thaw_task races · 24b7ead3
      Oleg Nesterov 提交于
      wait_event_freezable() and friends stop the waiting if try_to_freeze()
      fails. This is not right, we can race with __thaw_task() and in this
      case
      
      	- wait_event_freezable() returns the wrong ERESTARTSYS
      
      	- wait_event_freezable_timeout() can return the positive
      	  value while condition == F
      
      Change the code to always check __retval/condition before return.
      
      Note: with or without this patch the timeout logic looks strange,
      probably we should recalc timeout if try_to_freeze() returns T.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      24b7ead3
    • T
      freezer: kill unused set_freezable_with_signal() · 34b087e4
      Tejun Heo 提交于
      There's no in-kernel user of set_freezable_with_signal() left.  Mixing
      TIF_SIGPENDING with kernel threads can lead to nasty corner cases as
      kernel threads never travel signal delivery path on their own.
      
      e.g. the current implementation is buggy in the cancelation path of
      __thaw_task().  It calls recalc_sigpending_and_wake() in an attempt to
      clear TIF_SIGPENDING but the function never clears it regardless of
      sigpending state.  This means that signallable freezable kthreads may
      continue executing with !freezing() && stuck TIF_SIGPENDING, which can
      be troublesome.
      
      This patch removes set_freezable_with_signal() along with
      PF_FREEZER_NOSIG and recalc_sigpending*() calls in freezer.  User
      tasks get TIF_SIGPENDING, kernel tasks get woken up and the spurious
      sigpending is dealt with in the usual signal delivery path.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NOleg Nesterov <oleg@redhat.com>
      34b087e4
    • T
      dmatest: don't use set_freezable_with_signal() · adfa543e
      Tejun Heo 提交于
      Commit 981ed70d (dmatest: make dmatest threads freezable) made
      dmatest kthread use set_freezable_with_signal(); however, the
      interface is scheduled to be removed in the next merge window.
      
      The problem is that unlike userland tasks there's no default place
      which handles signal pending state and it isn't clear who owns and/or
      is responsible for clearing TIF_SIGPENDING.  For example, in the
      current code, try_to_freeze() clears TIF_SIGPENDING but it isn't sure
      whether it actually owns the TIF_SIGPENDING nor is it race-free -
      ie. the task may continue to run with TIF_SIGPENDING set after the
      freezable section.
      
      Unfortunately, we don't have wait_for_completion_freezable_timeout().
      This patch open codes it and uses wait_event_freezable_timeout()
      instead and removes timeout reloading - wait_event_freezable_timeout()
      won't return across freezing events (currently racy but fix scheduled)
      and timer doesn't decrement while the task is in freezer.  Although
      this does lose timer-reset-over-freezing, given that timeout is
      supposed to be long enough and failure to finish inside is considered
      irrecoverable, I don't think this is worth the complexity.
      
      While at it, move completion to outer scope and explain that we're
      ignoring dangling pointer problem after timeout.  This should give
      slightly better chance at avoiding oops after timeout.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NDan Williams <dan.j.williams@intel.com>
      Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
      Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
      adfa543e
  6. 23 11月, 2011 19 次提交
  7. 22 11月, 2011 1 次提交