1. 15 Jul, 2014 6 commits
    • Tejun Heo's avatar
      cgroup: initialize cgrp_dfl_root_inhibit_ss_mask from !->dfl_files test · 5de4fa13
      Tejun Heo authored
      cgrp_dfl_root_inhibit_ss_mask determines which subsystems are not
      supported on the default hierarchy and is currently initialized
      statically and just includes the debug subsystem.  Now that there's
      cgroup_subsys->dfl_files, we can easily tell which subsystems support
      the default hierarchy or not.
      
      Let's initialize cgrp_dfl_root_inhibit_ss_mask by testing whether
      cgroup_subsys->dfl_files is NULL.  After all, subsystems with NULL
      ->dfl_files aren't useable on the default hierarchy anyway.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      5de4fa13
    • Tejun Heo's avatar
      cgroup: make CFTYPE_ONLY_ON_DFL and CFTYPE_NO_ internal to cgroup core · 05ebb6e6
      Tejun Heo authored
      cgroup now distinguishes cftypes for the default and legacy
      hierarchies more explicitly by using separate arrays and
      CFTYPE_ONLY_ON_DFL and CFTYPE_INSANE should be and are used only
      inside cgroup core proper.  Let's make it clear that the flags are
      internal by prefixing them with double underscores.
      
      CFTYPE_INSANE is renamed to __CFTYPE_NOT_ON_DFL for consistency.  The
      two flags are also collected and assigned bits >= 16 so that they
      aren't mixed with the published flags.
      
      v2: Convert the extra ones in cgroup_exit_cftypes() which are added by
          revision to the previous patch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      05ebb6e6
    • Tejun Heo's avatar
      cgroup: distinguish the default and legacy hierarchies when handling cftypes · a8ddc821
      Tejun Heo authored
      Until now, cftype arrays carried files for both the default and legacy
      hierarchies and the files which needed to be used on only one of them
      were flagged with either CFTYPE_ONLY_ON_DFL or CFTYPE_INSANE.  This
      gets confusing very quickly and we may end up exposing interface files
      to the default hierarchy without thinking it through.
      
      This patch makes cgroup core provide separate sets of interfaces for
      cftype handling so that the cftypes for the default and legacy
      hierarchies are clearly distinguished.  The previous two patches
      renamed the existing ones so that they clearly indicate that they're
      for the legacy hierarchies.  This patch adds the interface for the
      default hierarchy and apply them selectively depending on the
      hierarchy type.
      
      * cftypes added through cgroup_subsys->dfl_cftypes and
        cgroup_add_dfl_cftypes() only show up on the default hierarchy.
      
      * cftypes added through cgroup_subsys->legacy_cftypes and
        cgroup_add_legacy_cftypes() only show up on the legacy hierarchies.
      
      * cgroup_subsys->dfl_cftypes and ->legacy_cftypes can point to the
        same array for the cases where the interface files are identical on
        both types of hierarchies.
      
      * This makes all the existing subsystem interface files legacy-only by
        default and all subsystems will have no interface file created when
        enabled on the default hierarchy.  Each subsystem should explicitly
        review and compose the interface for the default hierarchy.
      
      * A boot param "cgroup__DEVEL__legacy_files_on_dfl" is added which
        makes subsystems which haven't decided the interface files for the
        default hierarchy to present the legacy files on the default
        hierarchy so that its behavior on the default hierarchy can be
        tested.  As the awkward name suggests, this is for development only.
      
      * memcg's CFTYPE_INSANE on "use_hierarchy" is noop now as the whole
        array isn't used on the default hierarchy.  The flag is removed.
      
      v2: Updated documentation for cgroup__DEVEL__legacy_files_on_dfl.
      
      v3: Clear CFTYPE_ONLY_ON_DFL and CFTYPE_INSANE when cfts are removed
          as suggested by Li.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Aristeu Rozanski <aris@redhat.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      a8ddc821
    • Tejun Heo's avatar
      cgroup: replace cgroup_add_cftypes() with cgroup_add_legacy_cftypes() · 2cf669a5
      Tejun Heo authored
      Currently, cftypes added by cgroup_add_cftypes() are used for both the
      unified default hierarchy and legacy ones and subsystems can mark each
      file with either CFTYPE_ONLY_ON_DFL or CFTYPE_INSANE if it has to
      appear only on one of them.  This is quite hairy and error-prone.
      Also, we may end up exposing interface files to the default hierarchy
      without thinking it through.
      
      cgroup_subsys will grow two separate cftype addition functions and
      apply each only on the hierarchies of the matching type.  This will
      allow organizing cftypes in a lot clearer way and encourage subsystems
      to scrutinize the interface which is being exposed in the new default
      hierarchy.
      
      In preparation, this patch adds cgroup_add_legacy_cftypes() which
      currently is a simple wrapper around cgroup_add_cftypes() and replaces
      all cgroup_add_cftypes() usages with it.
      
      While at it, this patch drops a completely spurious return from
      __hugetlb_cgroup_file_init().
      
      This patch doesn't introduce any functional differences.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      2cf669a5
    • Tejun Heo's avatar
      cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes · 5577964e
      Tejun Heo authored
      Currently, cgroup_subsys->base_cftypes is used for both the unified
      default hierarchy and legacy ones and subsystems can mark each file
      with either CFTYPE_ONLY_ON_DFL or CFTYPE_INSANE if it has to appear
      only on one of them.  This is quite hairy and error-prone.  Also, we
      may end up exposing interface files to the default hierarchy without
      thinking it through.
      
      cgroup_subsys will grow two separate cftype arrays and apply each only
      on the hierarchies of the matching type.  This will allow organizing
      cftypes in a lot clearer way and encourage subsystems to scrutinize
      the interface which is being exposed in the new default hierarchy.
      
      In preparation, this patch renames cgroup_subsys->base_cftypes to
      cgroup_subsys->legacy_cftypes.  This patch is pure rename.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Aristeu Rozanski <aris@redhat.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      5577964e
    • Tejun Heo's avatar
      cgroup: split cgroup_base_files[] into cgroup_{dfl|legacy}_base_files[] · a14c6874
      Tejun Heo authored
      Currently cgroup_base_files[] contains the cgroup core interface files
      for both legacy and default hierarchies with each file tagged with
      CFTYPE_INSANE and CFTYPE_ONLY_ON_DFL.  This is difficult to read.
      
      Let's separate it out to two separate tables, cgroup_dfl_base_files[]
      and cgroup_legacy_base_files[], and use the appropriate one in
      cgroup_mkdir() depending on the hierarchy type.  This makes tagging
      each file unnecessary.
      
      This patch doesn't introduce any behavior changes.
      
      v2: cgroup_dfl_base_files[] was missing the termination entry
          triggering WARN in cgroup_init_cftypes() for 0day kernel testing
          robot.  Fixed.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Cc: Jet Chen <jet.chen@intel.com>
      a14c6874
  2. 09 Jul, 2014 16 commits
    • Li Zefan's avatar
      cpuset: export effective masks to userspace · afd1a8b3
      Li Zefan authored
      cpuset.cpus and cpuset.mems are the configured masks, and we need
      to export effective masks to userspace, so users know the real
      cpus_allowed and mems_allowed that apply to the tasks in a cpuset.
      
      v2:
      - export those masks unconditionally, suggested by Tejun.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      afd1a8b3
    • Li Zefan's avatar
      cpuset: allow writing offlined masks to cpuset.cpus/mems · 5d8ba82c
      Li Zefan authored
      As the configured masks won't be limited by its parent, and the top
      cpuset's masks won't change when hotplug happens, it's natural to
      allow writing offlined masks to the configured masks.
      
      If on default hierarchy:
      
      	# echo 0 > /sys/devices/system/cpu/cpu1/online
      	# mkdir /cpuset/sub
      	# echo 1 > /cpuset/sub/cpuset.cpus
      	# cat /cpuset/sub/cpuset.cpus
      	1
      
      If on legacy hierarchy:
      
      	# echo 0 > /sys/devices/system/cpu/cpu1/online
      	# mkdir /cpuset/sub
      	# echo 1 > /cpuset/sub/cpuset.cpus
      	-bash: echo: write error: Invalid argument
      
      Note the checks don't need to be gated by cgroup_on_dfl, because we've
      initialized top_cpuset.{cpus,mems}_allowed accordingly in cpuset_bind().
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      5d8ba82c
    • Li Zefan's avatar
      cpuset: enable onlined cpu/node in effective masks · be4c9dd7
      Li Zefan authored
      Firstly offline cpu1:
      
        # echo 0-1 > cpuset.cpus
        # echo 0 > /sys/devices/system/cpu/cpu1/online
        # cat cpuset.cpus
        0-1
        # cat cpuset.effective_cpus
        0
      
      Then online it:
      
        # echo 1 > /sys/devices/system/cpu/cpu1/online
        # cat cpuset.cpus
        0-1
        # cat cpuset.effective_cpus
        0-1
      
      And cpuset will bring it back to the effective mask.
      
      The implementation is quite straightforward. Instead of calculating the
      offlined cpus/mems and do updates, we just set the new effective_mask
      to online_mask & congifured_mask.
      
      This is a behavior change for default hierarchy, so legacy hierarchy
      won't be affected.
      
      v2:
      - make refactoring of cpuset_hotplug_update_tasks() as seperate patch,
        suggested by Tejun.
      - make hotplug_update_tasks_insane() use @new_cpus and @new_mems as
        hotplug_update_tasks_sane() does.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      be4c9dd7
    • Li Zefan's avatar
      cpuset: refactor cpuset_hotplug_update_tasks() · 390a36aa
      Li Zefan authored
      We mix the handling for both default hierarchy and legacy hierarchy in
      the same function, and it's quite messy, so split into two functions.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      390a36aa
    • Li Zefan's avatar
      cpuset: make cs->{cpus, mems}_allowed as user-configured masks · 7e88291b
      Li Zefan authored
      Now we've used effective cpumasks to enforce hierarchical manner,
      we can use cs->{cpus,mems}_allowed as configured masks.
      
      Configured masks can be changed by writing cpuset.cpus and cpuset.mems
      only. The new behaviors are:
      
      - They won't be changed by hotplug anymore.
      - They won't be limited by its parent's masks.
      
      This ia a behavior change, but won't take effect unless mount with
      sane_behavior.
      
      v2:
      - Add comments to explain the differences between configured masks and
      effective masks.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      7e88291b
    • Li Zefan's avatar
      cpuset: apply cs->effective_{cpus,mems} · ae1c8023
      Li Zefan authored
      Now we can use cs->effective_{cpus,mems} as effective masks. It's
      used whenever:
      
      - we update tasks' cpus_allowed/mems_allowed,
      - we want to retrieve tasks_cs(tsk)'s cpus_allowed/mems_allowed.
      
      They actually replace effective_{cpu,node}mask_cpuset().
      
      effective_mask == configured_mask & parent effective_mask except when
      the reault is empty, in which case it inherits parent effective_mask.
      The result equals the mask computed from effective_{cpu,node}mask_cpuset().
      
      This won't affect the original legacy hierarchy, because in this case we
      make sure the effective masks are always the same with user-configured
      masks.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      ae1c8023
    • Li Zefan's avatar
      cpuset: initialize top_cpuset's configured masks at mount · 39bd0d15
      Li Zefan authored
      We now have to support different behaviors for default hierachy and
      legacy hiearchy, top_cpuset's configured masks need to be initialized
      accordingly.
      
      Suppose we've offlined cpu1.
      
      On default hierarchy:
      
      	# mount -t cgroup -o __DEVEL__sane_behavior xxx /cpuset
      	# cat /cpuset/cpuset.cpus
      	0-15
      
      On legacy hierarchy:
      
      	# mount -t cgroup xxx /cpuset
      	# cat /cpuset/cpuset.cpus
      	0,2-15
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      39bd0d15
    • Li Zefan's avatar
      cpuset: use effective cpumask to build sched domains · 8b5f1c52
      Li Zefan authored
      We're going to have separate user-configured masks and effective ones.
      
      Eventually configured masks can only be changed by writing cpuset.cpus
      and cpuset.mems, and they won't be restricted by parent cpuset. While
      effective masks reflect cpu/memory hotplug and hierachical restriction,
      and these are the real masks that apply to the tasks in the cpuset.
      
      We calculate effective mask this way:
        - top cpuset's effective_mask == online_mask, otherwise
        - cpuset's effective_mask == configured_mask & parent effective_mask,
          if the result is empty, it inherits parent effective mask.
      
      Those behavior changes are for default hierarchy only. For legacy
      hierarchy, effective_mask and configured_mask are the same, so we won't
      break old interfaces.
      
      We should partition sched domains according to effective_cpus, which
      is the real cpulist that takes effects on tasks in the cpuset.
      
      This won't introduce behavior change.
      
      v2:
      - Add a comment for the call of rebuild_sched_domains(), suggested
      by Tejun.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      8b5f1c52
    • Li Zefan's avatar
      cpuset: inherit ancestor's masks if effective_{cpus, mems} becomes empty · 554b0d1c
      Li Zefan authored
      We're going to have separate user-configured masks and effective ones.
      
      Eventually configured masks can only be changed by writing cpuset.cpus
      and cpuset.mems, and they won't be restricted by parent cpuset. While
      effective masks reflect cpu/memory hotplug and hierachical restriction,
      and these are the real masks that apply to the tasks in the cpuset.
      
      We calculate effective mask this way:
        - top cpuset's effective_mask == online_mask, otherwise
        - cpuset's effective_mask == configured_mask & parent effective_mask,
          if the result is empty, it inherits parent effective mask.
      
      Those behavior changes are for default hierarchy only. For legacy
      hierarchy, effective_mask and configured_mask are the same, so we won't
      break old interfaces.
      
      To make cs->effective_{cpus,mems} to be effective masks, we need to
        - update the effective masks at hotplug
        - update the effective masks at config change
        - take on ancestor's mask when the effective mask is empty
      
      The last item is done here.
      
      This won't introduce behavior change.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      554b0d1c
    • Li Zefan's avatar
      cpuset: update cs->effective_{cpus, mems} when config changes · 734d4513
      Li Zefan authored
      We're going to have separate user-configured masks and effective ones.
      
      Eventually configured masks can only be changed by writing cpuset.cpus
      and cpuset.mems, and they won't be restricted by parent cpuset. While
      effective masks reflect cpu/memory hotplug and hierachical restriction,
      and these are the real masks that apply to the tasks in the cpuset.
      
      We calculate effective mask this way:
        - top cpuset's effective_mask == online_mask, otherwise
        - cpuset's effective_mask == configured_mask & parent effective_mask,
          if the result is empty, it inherits parent effective mask.
      
      Those behavior changes are for default hierarchy only. For legacy
      hierarchy, effective_mask and configured_mask are the same, so we won't
      break old interfaces.
      
      To make cs->effective_{cpus,mems} to be effective masks, we need to
        - update the effective masks at hotplug
        - update the effective masks at config change
        - take on ancestor's mask when the effective mask is empty
      
      The second item is done here. We don't need to treat root_cs specially
      in update_cpumasks_hier().
      
      This won't introduce behavior change.
      
      v3:
      - add a WARN_ON() to check if effective masks are the same with configured
        masks on legacy hierarchy.
      - pass trialcs->cpus_allowed to update_cpumasks_hier() and add a comment for
        it. Similar change for update_nodemasks_hier(). Suggested by Tejun.
      
      v2:
      - revise the comment in update_{cpu,node}masks_hier(), suggested by Tejun.
      - fix to use @cp instead of @cs in these two functions.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      734d4513
    • Li Zefan's avatar
      cpuset: update cpuset->effective_{cpus,mems} at hotplug · 1344ab9c
      Li Zefan authored
      We're going to have separate user-configured masks and effective ones.
      
      Eventually configured masks can only be changed by writing cpuset.cpus
      and cpuset.mems, and they won't be restricted by parent cpuset. While
      effective masks reflect cpu/memory hotplug and hierachical restriction,
      and these are the real masks that apply to the tasks in the cpuset.
      
      We calculate effective mask this way:
        - top cpuset's effective_mask == online_mask, otherwise
        - cpuset's effective_mask == configured_mask & parent effective_mask,
          if the result is empty, it inherits parent effective mask.
      
      Those behavior changes are for default hierarchy only. For legacy
      hierarchy, effective_mask and configured_mask are the same, so we won't
      break old interfaces.
      
      To make cs->effective_{cpus,mems} to be effective masks, we need to
        - update the effective masks at hotplug
        - update the effective masks at config change
        - take on ancestor's mask when the effective mask is empty
      
      The first item is done here.
      
      This won't introduce behavior change.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      1344ab9c
    • Li Zefan's avatar
      cpuset: add cs->effective_cpus and cs->effective_mems · e2b9a3d7
      Li Zefan authored
      We're going to have separate user-configured masks and effective ones.
      
      Eventually configured masks can only be changed by writing cpuset.cpus
      and cpuset.mems, and they won't be restricted by parent cpuset. While
      effective masks reflect cpu/memory hotplug and hierachical restriction,
      and these are the real masks that apply to the tasks in the cpuset.
      
      We calculate effective mask this way:
        - top cpuset's effective_mask == online_mask, otherwise
        - cpuset's effective_mask == configured_mask & parent effective_mask,
          if the result is empty, it inherits parent effective mask.
      
      Those behavior changes are for default hierarchy only. For legacy
      hierachy, effective_mask and configured_mask are the same, so we won't
      break old interfaces.
      
      This patch adds the effective masks to struct cpuset and initializes
      them. The effective masks of the top cpuset is the same with configured
      masks, and a child cpuset inherits its parent's effective masks.
      
      This won't introduce behavior change.
      
      v2:
      - s/real_{mems,cpus}_allowed/effective_{mems,cpus}, suggested by Tejun.
      - don't init effective masks in cpuset_css_online() if !cgroup_on_dfl.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      e2b9a3d7
    • Tejun Heo's avatar
      cgroup: clean up sane_behavior handling · 7b9a6ba5
      Tejun Heo authored
      After the previous patch to remove sane_behavior support from
      non-default hierarchies, CGRP_ROOT_SANE_BEHAVIOR is used only to
      indicate the default hierarchy while parsing mount options.  This
      patch makes the following cleanups around it.
      
      * Don't show it in the mount option.  Eventually the default hierarchy
        will be assigned a different filesystem type.
      
      * As sane_behavior is no longer effective on non-default hierarchies
        and the default hierarchy doesn't accept any mount options,
        parse_cgroupfs_options() can consider sane_behavior mount option as
        indicating the default hierarchy and fail if any other options are
        specified with it.  While at it, remove one of the double blank
        lines in the function.
      
      * cgroup_mount() can now simply test CGRP_ROOT_SANE_BEHAVIOR to tell
        whether to mount the default hierarchy or not.
      
      * As CGROUP_ROOT_SANE_BEHAVIOR's only role now is indicating whether
        to select the default hierarchy or not during mount, it doesn't need
        to be set in the default hierarchy itself.  cgroup_init_early()
        updated accordingly.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      7b9a6ba5
    • Tejun Heo's avatar
      cgroup: remove sane_behavior support on non-default hierarchies · aa6ec29b
      Tejun Heo authored
      sane_behavior has been used as a development vehicle for the default
      unified hierarchy.  Now that the default hierarchy is in place, the
      flag became redundant and confusing as its usage is allowed on all
      hierarchies.  There are gonna be either the default hierarchy or
      legacy ones.  Let's make that clear by removing sane_behavior support
      on non-default hierarchies.
      
      This patch replaces cgroup_sane_behavior() with cgroup_on_dfl().  The
      comment on top of CGRP_ROOT_SANE_BEHAVIOR is moved to on top of
      cgroup_on_dfl() with sane_behavior specific part dropped.
      
      On the default and legacy hierarchies w/o sane_behavior, this
      shouldn't cause any behavior differences.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      aa6ec29b
    • Tejun Heo's avatar
      cgroup: make interface file "cgroup.sane_behavior" legacy-only · c1d5d42e
      Tejun Heo authored
      "cgroup.sane_behavior" is added to help distinguishing whether
      sane_behavior is in effect or not.  We now have the default hierarchy
      where the flag is always in effect and are planning to remove
      supporting sane behavior on the legacy hierarchies making this file on
      the default hierarchy rather pointless.  Let's make it legacy only and
      thus always zero.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      c1d5d42e
    • Tejun Heo's avatar
      cgroup: remove CGRP_ROOT_OPTION_MASK · 7450e90b
      Tejun Heo authored
      cgroup_root->flags only contains CGRP_ROOT_* flags and there's no
      reason to mask the flags.  Remove CGRP_ROOT_OPTION_MASK.
      
      This doesn't cause any behavior differences.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      7450e90b
  3. 08 Jul, 2014 6 commits
    • Tejun Heo's avatar
      blkcg, memcg: make blkcg depend on memcg on the default hierarchy · 1ced953b
      Tejun Heo authored
      Currently, the blkio subsystem attributes all of writeback IOs to the
      root.  One of the issues is that there's no way to tell who originated
      a writeback IO from block layer.  Those IOs are usually issued
      asynchronously from a task which didn't have anything to do with
      actually generating the dirty pages.  The memory subsystem, when
      enabled, already keeps track of the ownership of each dirty page and
      it's desirable for blkio to piggyback instead of adding its own
      per-page tag.
      
      cgroup now has a mechanism to express such dependency -
      cgroup_subsys->depends_on.  This patch declares that blkcg depends on
      memcg so that memcg is enabled automatically on the default hierarchy
      when available.  Future changes will make blkcg map the memcg tag to
      find out the cgroup to blame for writeback IOs.
      
      As this means that a memcg may be made invisible, this patch also
      implements css_reset() for memcg which resets its basic
      configurations.  This implementation will probably need to be expanded
      to cover other states which are used in the default hierarchy.
      
      v2: blkcg's dependency on memcg is wrapped with CONFIG_MEMCG to avoid
          build failure.  Reported by kbuild test robot.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      1ced953b
    • Tejun Heo's avatar
      cgroup: implement cgroup_subsys->depends_on · af0ba678
      Tejun Heo authored
      Currently, the blkio subsystem attributes all of writeback IOs to the
      root.  One of the issues is that there's no way to tell who originated
      a writeback IO from block layer.  Those IOs are usually issued
      asynchronously from a task which didn't have anything to do with
      actually generating the dirty pages.  The memory subsystem, when
      enabled, already keeps track of the ownership of each dirty page and
      it's desirable for blkio to piggyback instead of adding its own
      per-page tag.
      
      blkio piggybacking on memory is an implementation detail which
      preferably should be handled automatically without requiring explicit
      userland action.  To achieve that, this patch implements
      cgroup_subsys->depends_on which contains the mask of subsystems which
      should be enabled together when the subsystem is enabled.
      
      The previous patches already implemented the support for enabled but
      invisible subsystems and cgroup_subsys->depends_on can be easily
      implemented by updating cgroup_refresh_child_subsys_mask() so that it
      calculates cgroup->child_subsys_mask considering
      cgroup_subsys->depends_on of the explicitly enabled subsystems.
      
      Documentation/cgroups/unified-hierarchy.txt is updated to explain that
      subsystems may not become immediately available after being unused
      from userland and that dependency could be a factor in it.  As
      subsystems may already keep residual references, this doesn't
      significantly change how subsystem rebinding can be used.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      af0ba678
    • Tejun Heo's avatar
      cgroup: implement cgroup_subsys->css_reset() · b4536f0c
      Tejun Heo authored
      cgroup is implementing support for subsystem dependency which would
      require a way to enable a subsystem even when it's not directly
      configured through "cgroup.subtree_control".
      
      The previous patches added support for explicitly and implicitly
      enabled subsystems and showing/hiding their interface files.  An
      explicitly enabled subsystem may become implicitly enabled if it's
      turned off through "cgroup.subtree_control" but there are subsystems
      depending on it.  In such cases, the subsystem, as it's turned off
      when seen from userland, shouldn't enforce any resource control.
      Also, the subsystem may be explicitly turned on later again and its
      interface files should be as close to the intial state as possible.
      
      This patch adds cgroup_subsys->css_reset() which is invoked when a css
      is hidden.  The callback should disable resource control and reset the
      state to the vanilla state.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      b4536f0c
    • Tejun Heo's avatar
      cgroup: make interface files visible iff enabled on cgroup->subtree_control · f63070d3
      Tejun Heo authored
      cgroup is implementing support for subsystem dependency which would
      require a way to enable a subsystem even when it's not directly
      configured through "cgroup.subtree_control".
      
      The preceding patch distinguished cgroup->subtree_control and
      ->child_subsys_mask where the former is the subsystems explicitly
      configured by the userland and the latter is all enabled subsystems
      currently is equal to the former but will include subsystems
      implicitly enabled through dependency.
      
      Subsystems which are enabled due to dependency shouldn't be visible to
      userland.  This patch updates cgroup_subtree_control_write() and
      create_css() such that interface files are not created for implicitly
      enabled subsytems.
      
      * @visible paramter is added to create_css().  Interface files are
        created only when true.
      
      * If an already implicitly enabled subsystem is turned on through
        "cgroup.subtree_control", the existing css should be used.  css
        draining is skipped.
      
      * cgroup_subtree_control_write() computes the new target
        cgroup->child_subsys_mask and create/kill or show/hide csses
        accordingly.
      
      As the two subsystem masks are still kept identical, this patch
      doesn't introduce any behavior changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      f63070d3
    • Tejun Heo's avatar
      cgroup: introduce cgroup->subtree_control · 667c2491
      Tejun Heo authored
      cgroup is implementing support for subsystem dependency which would
      require a way to enable a subsystem even when it's not directly
      configured through "cgroup.subtree_control".
      
      Previously, cgroup->child_subsys_mask directly reflected
      "cgroup.subtree_control" and the enabled subsystems in the child
      cgroups.  This patch adds cgroup->subtree_control which
      "cgroup.subtree_control" operates on.  cgroup->child_subsys_mask is
      now calculated from cgroup->subtree_control by
      cgroup_refresh_child_subsys_mask(), which sets it identical to
      cgroup->subtree_control for now.
      
      This will allow using cgroup->child_subsys_mask for all the enabled
      subsystems including the implicit ones and ->subtree_control for
      tracking the explicitly requested ones.  This patch keeps the two
      masks identical and doesn't introduce any behavior changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      667c2491
    • Tejun Heo's avatar
      cgroup: reorganize cgroup_subtree_control_write() · c29adf24
      Tejun Heo authored
      Make the following two reorganizations to
      cgroup_subtree_control_write().  These are to prepare for future
      changes and shouldn't cause any functional difference.
      
      * Move availability above css offlining wait.
      
      * Move cgrp->child_subsys_mask update above new css creation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      c29adf24
  4. 22 Jun, 2014 6 commits
    • Linus Torvalds's avatar
      Linux 3.16-rc2 · a497c3ba
      Linus Torvalds authored
      a497c3ba
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 8f5d2708
      Linus Torvalds authored
      Pull i2c new drivers from Wolfram Sang:
       "Here is a pull request from i2c hoping for the "new driver" rule.
      
        Originally, I wanted to send this request during the merge window, but
        code checkers with very recent additions complained, so a few fixups
        were needed.  So, some more time went by and I merged rc1 to get a
        stable base"
      
      So the "new driver" rule is really about drivers that people absolutely
      need for the kernel to work on new hardware, which is not so much the
      case for i2c.  So I considered not pulling this, but eventually
      relented.
      
      Just for FYI: the whole (and only) point of "new drivers" is not that
      new drivers cannot regress things (they can, and they have - by
      triggering badly tested code on machines that never triggered that code
      before), but because they can bring to life machines that otherwise
      wouldn't be useful at all without the drivers.
      
      So the new driver rule is for essential things that actual consumers
      would care about, ie devices like networking or disk drivers that matter
      to normal people (not server people - they run old kernels anyway, so
      mainlining new drivers is irrelevant for them).
      
      * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: sun6-p2wi: fix call to snprintf
        i2c: rk3x: add NULL entry to the end of_device_id array
        i2c: sun6i-p2wi: use proper return value in probe
        i2c: sunxi: add P2WI (Push/Pull 2 Wire Interface) controller support
        i2c: sunxi: add P2WI DT bindings documentation
        i2c: rk3x: add driver for Rockchip RK3xxx SoC I2C adapter
      8f5d2708
    • Linus Torvalds's avatar
      Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux · 2dfded82
      Linus Torvalds authored
      Pull file locking fixes from Jeff Layton:
       "File locking related bugfixes
      
        Nothing too earth-shattering here.  A fix for a potential regression
        due to a patch in pile #1, and the addition of a memory barrier to
        prevent a race condition between break_deleg and generic_add_lease"
      
      * tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux:
        locks: set fl_owner for leases back to current->files
        locks: add missing memory barrier in break_deleg
      2dfded82
    • Linus Torvalds's avatar
      Merge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild · 532f5138
      Linus Torvalds authored
      Pull kbuild fixes from Michal Marek:
       "There are three fixes for regressions caused by the relative paths
        series: deb-pkg, tar-pkg and *docs did not work with O=.
      
        Plus, there is a fix for the linux-headers deb package and a fixed
        typo.  These are not regression fixes but are safe enough"
      
      * 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
        kbuild: fix a typo in a kbuild document
        builddeb: fix missing headers in linux-headers package
        Documentation: Fix DocBook build with relative $(srctree)
        kbuild: Fix tar-pkg with relative $(objtree)
        deb-pkg: Fix for relative paths
      532f5138
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · e13d100b
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "This fixes some lockups in btrfs reported with rc1.  It probably has
        some performance impact because it is backing off our spinning locks
        more often and switching to a blocking lock.  I'll be able to nail
        that down next week, but for now I want to get the lockups taken care
        of.
      
        Otherwise some more stack reduction and assorted fixes"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix wrong error handle when the device is missing or is not writeable
        Btrfs: fix deadlock when mounting a degraded fs
        Btrfs: use bio_endio_nodec instead of open code
        Btrfs: fix NULL pointer crash when running balance and scrub concurrently
        btrfs: Skip scrubbing removed chunks to avoid -ENOENT.
        Btrfs: fix broken free space cache after the system crashed
        Btrfs: make free space cache write out functions more readable
        Btrfs: remove unused wait queue in struct extent_buffer
        Btrfs: fix deadlocks with trylock on tree nodes
      e13d100b
    • Linus Torvalds's avatar
      Merge branch 'for-3.16' of git://linux-nfs.org/~bfields/linux · 147f1404
      Linus Torvalds authored
      Pull nfsd bugfixes from Bruce Fields:
       "Fixes for a new regression from the xdr encoding rewrite, and a
        delegation problem we've had for a while (made somewhat more annoying
        by the vfs delegation support added in 3.13)"
      
      * 'for-3.16' of git://linux-nfs.org/~bfields/linux:
        NFSD: fix bug for readdir of pseudofs
        NFSD: Don't hand out delegations for 30 seconds after recalling them.
      147f1404
  5. 21 Jun, 2014 6 commits
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 401c58fc
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "This is larger than usual: the main reason are the ARM symbol lookup
        speedups that came in late and were hard to resist.
      
        There's also a kprobes fix and various tooling fixes, plus the minimal
        re-enablement of the mmap2 support interface"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
        x86/kprobes: Fix build errors and blacklist context_track_user
        perf tests: Add test for closing dso objects on EMFILE error
        perf tests: Add test for caching dso file descriptors
        perf tests: Allow reuse of test_file function
        perf tests: Spawn child for each test
        perf tools: Add dso__data_* interface descriptons
        perf tools: Allow to close dso fd in case of open failure
        perf tools: Add file size check and factor dso__data_read_offset
        perf tools: Cache dso data file descriptor
        perf tools: Add global count of opened dso objects
        perf tools: Add global list of opened dso objects
        perf tools: Add data_fd into dso object
        perf tools: Separate dso data related variables
        perf tools: Cache register accesses for unwind processing
        perf record: Fix to honor user freq/interval properly
        perf timechart: Reflow documentation
        perf probe: Improve error messages in --line option
        perf probe: Improve an error message of perf probe --vars mode
        perf probe: Show error code and description in verbose mode
        perf probe: Improve error message for unknown member of data structure
        ...
      401c58fc
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus.patch' of... · 7b08d618
      Linus Torvalds authored
      Merge branch 'locking-urgent-for-linus.patch' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
      
      Pull rtmutex fixes from Thomas Gleixner:
       "Another three patches to make the rtmutex code more robust.  That's
        the last urgent fallout from the big futex/rtmutex investigation"
      
      * 'locking-urgent-for-linus.patch' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rtmutex: Plug slow unlock race
        rtmutex: Detect changes in the pi lock chain
        rtmutex: Handle deadlock detection smarter
      7b08d618
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 7a8e9c80
      Linus Torvalds authored
      Pull s390 patches from Martin Schwidefsky:
       "A couple of bug fixes, a debug change for qdio, an update for the
        default config, and one small extension.
      
        The watchdog module based on diagnose 0x288 is converted to the
        watchdog API and it now works under LPAR as well"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/ccwgroup: use ccwgroup_ungroup wrapper
        s390/ccwgroup: fix an uninitialized return code
        s390/ccwgroup: obtain extra reference for asynchronous processing
        qdio: Keep device-specific dbf entries
        s390/compat: correct ucontext layout for high gprs
        s390/cio: set device name as early as possible
        s390: update default configuration
        s390: avoid format strings leaking into names
        s390/airq: silence lockdep warning
        s390/watchdog: add support for LPAR operation (diag288)
        s390/watchdog: use watchdog API
        s390/sclp_vt220: Enable ASCII console per default
        s390/qdio: replace shift loop by ilog2
        s390/cio: silence lockdep warning
        s390/uaccess: always load the kernel ASCE after task switch
        s390/ap_bus: Make modules parameters visible in sysfs
      7a8e9c80
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/gxt/linux · f1b35b83
      Linus Torvalds authored
      Pull UniCore32 bug fixes from Guan Xuetao:
       "This includes bugfixes to make unicore32 successfully build under
        defconfig, and some changes for allmodconfig (though not finished)"
      
      * tag 'for-linus' of git://github.com/gxt/linux:
        unicore32: Remove ARCH_HAS_CPUFREQ config option
        UniCore32: Change git tree location information in MAINTAINERS
        arch: unicore32: ksyms: export '__cpuc_coherent_kern_range' to avoid compiling failure
        arch: unicore32: ksyms: export 'pm_power_off' to avoid compiling failure.
        arch: unicore32: ksyms: export additional find_first_*() to avoid compiling failure
        arch:unicore32:mm: add devmem_is_allowed() to support STRICT_DEVMEM
        unicore32: include: asm: add missing ')' for PAGE_* macros in pgtable.h
        arch/unicore32/kernel/setup.c: add generic 'screen_info' to avoid compiling failure
        drivers: scsi: mvsas: fix compiling issue by adding 'MVS_' for "enum pci_interrupt_cause"
        arch: unicore32: kernel: ksyms: remove 'bswapsi2' and 'muldi3' to avoid compiling failure
        arch/unicore32/kernel/ksyms.c: remove 2 export symbols to avoid compiling failure
        drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue MIME-Version: 1.0
        drivers/rtc/rtc-puv3.c: use dev_dbg() instead of dev_debug() for typo issue
        arch/unicore32/include/asm/io.h: add readl_relaxed() generic definition
        arch/unicore32/include/asm/ptrace.h: add generic definition for profile_pc()
        arch/unicore32/mm/alignment.c: include "asm/pgtable.h" to avoid compiling error
        arch/unicore32/kernel/clock.c: add readl() and writel() for 'PM_' macros
        arch/unicore32/kernel/module.c: use __vmalloc_node_range() instead of __vmalloc_area()
        arch/unicore32/kernel/ksyms.c: remove several undefined exported symbols
      f1b35b83
    • Linus Torvalds's avatar
      Merge tag 'char-misc-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 60761c10
      Linus Torvalds authored
      Pull char / misc driver fixes from Greg KH:
       "Here are 3 patches, one a revert of the UIO patch you objected to in
        3.16-rc1 and that no one wanted to defend, a w1 driver bugfix, and a
        MAINTAINERS update for the vmware balloon driver.
      
        All of these, except for the MAINTAINERS update which just got added,
        have been in linux-next just fine"
      
      * tag 'char-misc-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        MAINTAINERS: add entry for VMware Balloon driver
        w1: mxc_w1: Fix incorrect "presence" status
        Revert "uio: fix vma io range check in mmap"
      60761c10
    • Linus Torvalds's avatar
      Merge tag 'staging-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · e6934ab4
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are a few fixes for staging and iio drivers that resolve issues
        reported in 3.16-rc1.
      
        All have been in linux-next just fine"
      
      * tag 'staging-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        imx-drm: parallel-display: Fix DPMS default state.
        staging: android: timed_output: fix use after free of dev
        staging: comedi: addi_apci_1564: add addi_watchdog dependency
        staging: rtl8723au: Reference correct firmwarefiles with MODULE_FIRMWARE()
        staging: rtl8723au: Request correct firmware file for A-cut parts
        iio: adc: checking for NULL instead of IS_ERR() in probe
        iio: adc: at91: signedness bug in at91_adc_get_trigger_value_by_name()
        iio: mxs-lradc: fix divider
        iio: Fix endianness issue in ak8975_read_axis()
        staging/iio: IIO_SIMPLE_DUMMY_BUFFER neds IIO_BUFFER
        twl4030-madc: Request processed values in twl4030_get_madc_conversion
        staging: iio: tsl2x7x_core: fix proximity treshold
        iio: Fix two mpl3115 issues in measurement conversion
        iio: hid-sensors: Get feature report from sensor hub after changing power state
      e6934ab4