Linux Container Development
 help / color / mirror / Atom feed
  • [parent not found: <1375393801-4817-21-git-send-email-tj@kernel.org>]
  • [parent not found: <1375393801-4817-22-git-send-email-tj@kernel.org>]
  • [parent not found: <1375393801-4817-10-git-send-email-tj@kernel.org>]
  • [parent not found: <1375393801-4817-9-git-send-email-tj@kernel.org>]
  • [parent not found: <1375393801-4817-23-git-send-email-tj@kernel.org>]
  • * [PATCHSET cgroup/for-3.12] cgroup: use cgroup_subsys_state as the primary subsystem interface handle
    @ 2013-08-01 21:49 Tejun Heo
      0 siblings, 0 replies; 60+ messages in thread
    From: Tejun Heo @ 2013-08-01 21:49 UTC (permalink / raw)
      To: lizefan-hv44wF8Li93QT0dZR+AlfA
      Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
    	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
    	linux-kernel-u79uwXL29TY76Z2rM5mHXA
    
    Hello,
    
    Currently, struct cgroup * is used as the main interface handle
    between cgroup core and its subsystems, which works but is a bit
    clunky because subsystems usually care much more about css's
    (cgroup_subsys_state) a lot more than cgroups, which is natural as a
    css is the intersection between a cgroup and a subsystem.
    
    In addition to being a bit clunky, dealing with cgroups directly pose
    a bit of trouble for the planned unified hierarchy support on two
    fronts.  First, most iterations become subsystem dependent as task
    membership is affected by which subtree has the specific subsystem
    enabled and thus require specifying which subsystem the iteration is
    for, which is automatically achieved if the interfaces deal with css's
    instead of cgroups.
    
    Second, as css's may be created, attached, detached and destroyed
    dynamically multiple times across the lifetime of a given cgroup as
    they're enabled and disabled, which makes cgroup -> css mapping much
    more difficult to synchronize.  Giving out cgroup to subsystems and
    then requiring them to take the extra steps to deal with their css's
    coming and going dynamically is a lot more fragile than cgroup core
    proper handling it internally and giving out the resulting css's to
    subsystems.
    
    So, this patchset converts all cgroup subsystem APIs to deal with
    css's instead of cgroups.  The patchset is fairly large but most of
    the conversions, while being tedious, aren't complex.  At the end of
    series, subsystems no longer make cgroup -> css mapping themselves and
    cgroup_css() - formerly cgroup_subsys_state() - is made internal to
    cgroup core proper.
    
    This is a rather large update to the interface and likely to play as a
    barrier when porting commits, which is inconvenient but also provides
    an opportunity to clean up the API where we can as doing so won't
    significantly raise the level of inconvenience.  As such, this
    patchset contains some API cleanups and I'll probably follow up with
    further API updates that I've been meaning to do and, if you have some
    good idea to clean up cgroup internal API, this probably is a good
    time to submit it.
    
    This patchset contains the following 23 patches.
    
     0001-cgroup-s-cgroup_subsys_state-cgroup_css-s-task_subsy.patch
     0002-cpuset-drop-const-qualifiers-from-struct-cpuset-inst.patch
     0003-netprio_cgroup-pass-around-css-instead-of-cgroup-and.patch
     0004-hugetlb_cgroup-pass-around-hugetlb_cgroup-instead-of.patch
     0005-cgroup-add-subsystem-pointer-to-cgroup_subsys_state.patch
     0006-cgroup-add-update-accessors-which-obtain-subsys-spec.patch
     0007-cgroup-add-css_parent.patch
     0008-cgroup-pass-around-cgroup_subsys_state-instead-of-cg.patch
     0009-cgroup-add-subsys-backlink-pointer-to-cftype.patch
     0010-cgroup-pin-cgroup_subsys_state-when-opening-a-cgroup.patch
     0011-cgroup-add-cgroup-dummy_css.patch
     0012-cgroup-pass-around-cgroup_subsys_state-instead-of-cg.patch
     0013-cgroup-convert-cgroup_next_sibling-to-cgroup_next_ch.patch
     0014-cgroup-always-use-cgroup_next_child-to-walk-the-chil.patch
     0015-cgroup-make-hierarchy-iterators-deal-with-cgroup_sub.patch
     0016-cgroup-relocate-cgroup_advance_iter.patch
     0017-cgroup-rename-cgroup_iter-to-cgroup_task_iter.patch
     0018-cgroup-make-cgroup_task_iter-remember-the-cgroup-bei.patch
     0019-cgroup-remove-struct-cgroup_scanner.patch
     0020-cgroup-make-task-iterators-deal-with-cgroup_subsys_s.patch
     0021-cgroup-make-cftype-un-register_event-deal-with-cgrou.patch
     0022-cgroup-make-cgroup_taskset-deal-with-cgroup_subsys_s.patch
     0023-cgroup-unexport-cgroup_css.patch
    
    0001-0007 prepare for css-based interface.  Individual subsystems are
    updated so that they're easier to convert and css_parent() is added so
    that upward travelsal can be done without going through cgroup.
    
    0008 updates all subsystem methods.
    
    0009-0012 update file operations.
    
    0013-0015 update hierarchy iterators.
    
    0016-0020 update task iterators.
    
    0021 updates events.
    
    0022 updates task_set handling.
    
    0023 unexports cgroup_css().
    
    This patchset is available in the following git branch.
    
     git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cssfy
    
    diffstat follows.
    
     block/blk-cgroup.c           |   41 +-
     block/blk-cgroup.h           |   34 -
     block/blk-throttle.c         |   40 +-
     block/cfq-iosched.c          |   90 ++--
     fs/bio.c                     |    2
     include/linux/cgroup.h       |  268 +++++++-------
     include/linux/memcontrol.h   |    2
     include/linux/vmpressure.h   |    6
     include/net/cls_cgroup.h     |    4
     include/net/netprio_cgroup.h |    8
     kernel/cgroup.c              |  798 ++++++++++++++++++++++++-------------------
     kernel/cgroup_freezer.c      |  128 +++---
     kernel/cpuset.c              |  265 ++++++--------
     kernel/events/core.c         |   22 -
     kernel/sched/core.c          |  113 +++---
     kernel/sched/cpuacct.c       |   51 +-
     kernel/sched/sched.h         |    6
     mm/hugetlb_cgroup.c          |   69 +--
     mm/memcontrol.c              |  216 +++++------
     mm/vmpressure.c              |   25 -
     net/core/netprio_cgroup.c    |   72 +--
     net/ipv4/tcp_memcontrol.c    |   12
     net/sched/cls_cgroup.c       |   39 +-
     security/device_cgroup.c     |   63 +--
     24 files changed, 1210 insertions(+), 1164 deletions(-)
    
    Thanks.
    
    --
    tejun
    
    ^ permalink raw reply	[flat|nested] 60+ messages in thread

    end of thread, other threads:[~2013-08-09  0:12 UTC | newest]
    
    Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <1375393801-4817-1-git-send-email-tj@kernel.org>
         [not found] ` <1375393801-4817-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-01 21:49   ` [PATCH 01/23] cgroup: s/cgroup_subsys_state/cgroup_css/ s/task_subsys_state/task_css/ Tejun Heo
    2013-08-01 21:49   ` [PATCH 02/23] cpuset: drop "const" qualifiers from struct cpuset instances Tejun Heo
    2013-08-01 21:49   ` [PATCH 03/23] netprio_cgroup: pass around @css instead of @cgroup and kill struct cgroup_netprio_state Tejun Heo
         [not found]     ` <1375393801-4817-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-01 22:07       ` David Miller
    2013-08-02 11:42       ` Neil Horman
    2013-08-01 21:49   ` [PATCH 04/23] hugetlb_cgroup: pass around @hugetlb_cgroup instead of @cgroup Tejun Heo
         [not found]     ` <1375393801-4817-5-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02  4:35       ` Aneesh Kumar K.V
    2013-08-02 13:10       ` Michal Hocko
    2013-08-01 21:49   ` [PATCH 05/23] cgroup: add subsystem pointer to cgroup_subsys_state Tejun Heo
    2013-08-01 21:49   ` [PATCH 06/23] cgroup: add/update accessors which obtain subsys specific data from css Tejun Heo
    2013-08-01 21:49   ` [PATCH 07/23] cgroup: add css_parent() Tejun Heo
    2013-08-01 21:49   ` [PATCH 08/23] cgroup: pass around cgroup_subsys_state instead of cgroup in subsystem methods Tejun Heo
    2013-08-01 21:49   ` [PATCH 09/23] cgroup: add subsys backlink pointer to cftype Tejun Heo
    2013-08-01 21:49   ` [PATCH 10/23] cgroup: pin cgroup_subsys_state when opening a cgroupfs file Tejun Heo
    2013-08-01 21:49   ` [PATCH 11/23] cgroup: add cgroup->dummy_css Tejun Heo
    2013-08-01 21:49   ` [PATCH 12/23] cgroup: pass around cgroup_subsys_state instead of cgroup in file methods Tejun Heo
         [not found]     ` <1375393801-4817-13-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02 13:27       ` Michal Hocko
    2013-08-05 14:19       ` Vivek Goyal
    2013-08-05 18:04       ` Aristeu Rozanski
    2013-08-06  6:48       ` Daniel Wagner
    2013-08-01 21:49   ` [PATCH 13/23] cgroup: convert cgroup_next_sibling() to cgroup_next_child() Tejun Heo
    2013-08-01 21:49   ` [PATCH 14/23] cgroup: always use cgroup_next_child() to walk the children list Tejun Heo
    2013-08-01 21:49   ` [PATCH 15/23] cgroup: make hierarchy iterators deal with cgroup_subsys_state instead of cgroup Tejun Heo
         [not found]     ` <1375393801-4817-16-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02 13:32       ` Michal Hocko
    2013-08-05 14:25       ` Vivek Goyal
    2013-08-05 18:10       ` Aristeu Rozanski
    2013-08-01 21:49   ` [PATCH 16/23] cgroup: relocate cgroup_advance_iter() Tejun Heo
         [not found]     ` <1375393801-4817-17-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02  3:25       ` Li Zefan
         [not found]         ` <51FB26C6.2020100-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
    2013-08-02 19:35           ` Tejun Heo
    2013-08-01 21:49   ` [PATCH 17/23] cgroup: rename cgroup_iter to cgroup_task_iter Tejun Heo
         [not found]     ` <1375393801-4817-18-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02 13:35       ` Michal Hocko
    2013-08-01 21:49   ` [PATCH 18/23] cgroup: make cgroup_task_iter remember the cgroup being iterated Tejun Heo
         [not found]     ` <1375393801-4817-19-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02 13:38       ` Michal Hocko
    2013-08-01 21:49   ` [PATCH 19/23] cgroup: remove struct cgroup_scanner Tejun Heo
    2013-08-01 21:49   ` [PATCH 20/23] cgroup: make task iterators deal with cgroup_subsys_state instead of cgroup Tejun Heo
    2013-08-01 21:49   ` [PATCH 21/23] cgroup: make cftype->[un]register_event() " Tejun Heo
    2013-08-01 21:50   ` [PATCH 22/23] cgroup: make cgroup_taskset " Tejun Heo
    2013-08-01 21:50   ` [PATCH 23/23] cgroup: unexport cgroup_css() Tejun Heo
    2013-08-02  3:24   ` [PATCHSET cgroup/for-3.12] cgroup: use cgroup_subsys_state as the primary subsystem interface handle Li Zefan
    2013-08-09  0:12   ` Tejun Heo
         [not found] ` <1375393801-4817-21-git-send-email-tj@kernel.org>
         [not found]   ` <1375393801-4817-21-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02 13:40     ` [PATCH 20/23] cgroup: make task iterators deal with cgroup_subsys_state instead of cgroup Michal Hocko
         [not found] ` <1375393801-4817-22-git-send-email-tj@kernel.org>
         [not found]   ` <1375393801-4817-22-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02  4:08     ` [PATCH 21/23] cgroup: make cftype->[un]register_event() " Li Zefan
    2013-08-02 13:42     ` Michal Hocko
    2013-08-02 20:24     ` [PATCH v2 " Tejun Heo
         [not found]   ` <51FB30D3.9030900@huawei.com>
         [not found]     ` <51FB30D3.9030900-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
    2013-08-02 19:44       ` [PATCH " Tejun Heo
         [not found] ` <1375393801-4817-10-git-send-email-tj@kernel.org>
         [not found]   ` <1375393801-4817-10-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-05 12:49     ` [PATCH 09/23] cgroup: add subsys backlink pointer to cftype Vivek Goyal
         [not found] ` <1375393801-4817-9-git-send-email-tj@kernel.org>
         [not found]   ` <20130802131901.GB25432@dhcp22.suse.cz>
         [not found]     ` <20130802131901.GB25432-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
    2013-08-02 13:43       ` [PATCH 08/23] cgroup: pass around cgroup_subsys_state instead of cgroup in subsystem methods Michal Hocko
    2013-08-02 19:38       ` Tejun Heo
         [not found]     ` <20130802134305.GI25432@dhcp22.suse.cz>
         [not found]       ` <20130802134305.GI25432-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
    2013-08-02 19:52         ` Tejun Heo
         [not found]   ` <1375393801-4817-9-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-02  3:54     ` Li Zefan
         [not found]       ` <51FB2D70.3040208-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
    2013-08-02 19:36         ` Tejun Heo
    2013-08-02  4:02     ` Li Zefan
         [not found]       ` <51FB2F3D.5050904-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
    2013-08-02 19:41         ` Tejun Heo
    2013-08-02 13:19     ` Michal Hocko
    2013-08-02 20:24     ` [PATCH v2 " Tejun Heo
    2013-08-05 12:44     ` [PATCH " Vivek Goyal
    2013-08-05 17:57     ` Aristeu Rozanski
         [not found]   ` <20130802202408.GH29736@mtj.dyndns.org>
         [not found]     ` <20130802202408.GH29736-9pTldWuhBndy/B6EtB590w@public.gmane.org>
    2013-08-06  7:19       ` [PATCH v2 " Daniel Wagner
         [not found] ` <1375393801-4817-23-git-send-email-tj@kernel.org>
         [not found]   ` <1375393801-4817-23-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-08-06  6:53     ` [PATCH 22/23] cgroup: make cgroup_taskset deal with cgroup_subsys_state instead of cgroup Daniel Wagner
    2013-08-01 21:49 [PATCHSET cgroup/for-3.12] cgroup: use cgroup_subsys_state as the primary subsystem interface handle Tejun Heo
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox