)]}'
{
  "commit": "6a602efa026f4da71a82fd1cf74650cbdbe49464",
  "tree": "381736c0924ab8c7842c793206f5c06e70128d17",
  "parents": [
    "58cef666b862b0843184ac5db22d4c63becb8782"
  ],
  "author": {
    "name": "Tejun Heo",
    "email": "tj@kernel.org",
    "time": "Wed Jun 12 20:46:59 2013 -0700"
  },
  "committer": {
    "name": "Tejun Heo",
    "email": "tj@kernel.org",
    "time": "Wed Jun 12 20:46:59 2013 -0700"
  },
  "message": "cgroup: use percpu refcnt for cgroup_subsys_states\n\nA css (cgroup_subsys_state) is how each cgroup is represented to a\ncontroller.  As such, it can be used in hot paths across the various\nsubsystems different controllers are associated with.\n\nOne of the common operations is reference counting, which up until now\nhas been implemented using a global atomic counter and can have\nsignificant adverse impact on scalability.  For example, css refcnt\ncan be gotten and put multiple times by blkcg for each IO request.\nFor highops configurations which try to do as much per-cpu as\npossible, the global frequent refcnting can be very expensive.\n\nIn general, given the various and hugely diverse paths css\u0027s end up\nbeing used from, we need to make it cheap and highly scalable.  In its\nusage, css refcnting isn\u0027t very different from module refcnting.\n\nThis patch converts css refcnting to use the recently added\npercpu_ref.  css_get/tryget/put() directly maps to the matching\npercpu_ref operations and the deactivation logic is no longer\nnecessary as percpu_ref already has refcnt killing.\n\nThe only complication is that as the refcnt is per-cpu,\npercpu_ref_kill() in itself doesn\u0027t ensure that further tryget\noperations will fail, which we need to guarantee before invoking\n-\u003ecss_offline()\u0027s.  This is resolved collecting kill confirmation\nusing percpu_ref_kill_and_confirm() and initiating the offline phase\nof destruction after all css refcnt\u0027s are confirmed to be seen as\nkilled on all CPUs.  The previous patches already splitted destruction\ninto two phases, so percpu_ref_kill_and_confirm() can be hooked up\neasily.\n\nThis patch removes css_refcnt() which is used for rcu dereference\nsanity check in css_id().  While we can add a percpu refcnt API to ask\nthe same question, css_id() itself is scheduled to be removed fairly\nsoon, so let\u0027s not bother with it.  Just drop the sanity check and use\nrcu_dereference_raw() instead.\n\nv2: - init_cgroup_css() was calling percpu_ref_init() without checking\n      the return value.  This causes two problems - the obvious lack\n      of error handling and percpu_ref_init() being called from\n      cgroup_init_subsys() before the allocators are up, which\n      triggers warnings but doesn\u0027t cause actual problems as the\n      refcnt isn\u0027t used for roots anyway.  Fix both by moving\n      percpu_ref_init() to cgroup_create().\n\n    - The base references were put too early by\n      percpu_ref_kill_and_confirm() and cgroup_offline_fn() put the\n      refs one extra time.  This wasn\u0027t noticeable because css\u0027s go\n      through another RCU grace period before being freed.  Update\n      cgroup_destroy_locked() to grab an extra reference before\n      killing the refcnts.  This problem was noticed by Kent.\n\nSigned-off-by: Tejun Heo \u003ctj@kernel.org\u003e\nCc: Michal Hocko \u003cmhocko@suse.cz\u003e\nCc: Mike Snitzer \u003csnitzer@redhat.com\u003e\nCc: Vivek Goyal \u003cvgoyal@redhat.com\u003e\nCc: \"Alasdair G. Kergon\" \u003cagk@redhat.com\u003e\nCc: Jens Axboe \u003caxboe@kernel.dk\u003e\nCc: Mikulas Patocka \u003cmpatocka@redhat.com\u003e\nCc: Glauber Costa \u003cglommer@gmail.com\u003e\nCc: Kent Overstreet \u003ckoverstreet@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e345d8b90046fe7b87b0f96b79cafe6274754883",
      "old_mode": 33188,
      "old_path": "include/linux/cgroup.h",
      "new_id": "b7bd4beae29467e35b5fd59227c63eb946da232c",
      "new_mode": 33188,
      "new_path": "include/linux/cgroup.h"
    },
    {
      "type": "modify",
      "old_id": "ebbfc043153f6a7520da5c9f1a1ac8326c8f84b4",
      "old_mode": 33188,
      "old_path": "kernel/cgroup.c",
      "new_id": "2e9da7bf25cb740a2738b86ff3e211f8cf8d5306",
      "new_mode": 33188,
      "new_path": "kernel/cgroup.c"
    }
  ]
}
