-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'cgroup-for-6.2' of git://git.kernel.org/pub/scm/linux/kern…
…el/git/tj/cgroup Pull cgroup updates from Tejun Heo: "Nothing too interesting: - Add CONFIG_DEBUG_GROUP_REF which makes cgroup refcnt operations kprobable - A couple cpuset optimizations - Other misc changes including doc and test updates" * tag 'cgroup-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: remove rcu_read_lock()/rcu_read_unlock() in critical section of spin_lock_irq() cgroup/cpuset: Improve cpuset_css_alloc() description kselftest/cgroup: Add cleanup() to test_cpuset_prs.sh cgroup/cpuset: Optimize cpuset_attach() on v2 cgroup/cpuset: Skip spread flags update on v2 kselftest/cgroup: Fix gathering number of CPUs cgroup: cgroup refcnt functions should be exported when CONFIG_DEBUG_CGROUP_REF cgroup: Implement DEBUG_CGROUP_REF
- Loading branch information
Showing
6 changed files
with
181 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* css_get - obtain a reference on the specified css | ||
* @css: target css | ||
* | ||
* The caller must already have a reference. | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
void css_get(struct cgroup_subsys_state *css) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
percpu_ref_get(&css->refcnt); | ||
} | ||
CGROUP_REF_EXPORT(css_get) | ||
|
||
/** | ||
* css_get_many - obtain references on the specified css | ||
* @css: target css | ||
* @n: number of references to get | ||
* | ||
* The caller must already have a reference. | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
void css_get_many(struct cgroup_subsys_state *css, unsigned int n) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
percpu_ref_get_many(&css->refcnt, n); | ||
} | ||
CGROUP_REF_EXPORT(css_get_many) | ||
|
||
/** | ||
* css_tryget - try to obtain a reference on the specified css | ||
* @css: target css | ||
* | ||
* Obtain a reference on @css unless it already has reached zero and is | ||
* being released. This function doesn't care whether @css is on or | ||
* offline. The caller naturally needs to ensure that @css is accessible | ||
* but doesn't have to be holding a reference on it - IOW, RCU protected | ||
* access is good enough for this function. Returns %true if a reference | ||
* count was successfully obtained; %false otherwise. | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
bool css_tryget(struct cgroup_subsys_state *css) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
return percpu_ref_tryget(&css->refcnt); | ||
return true; | ||
} | ||
CGROUP_REF_EXPORT(css_tryget) | ||
|
||
/** | ||
* css_tryget_online - try to obtain a reference on the specified css if online | ||
* @css: target css | ||
* | ||
* Obtain a reference on @css if it's online. The caller naturally needs | ||
* to ensure that @css is accessible but doesn't have to be holding a | ||
* reference on it - IOW, RCU protected access is good enough for this | ||
* function. Returns %true if a reference count was successfully obtained; | ||
* %false otherwise. | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
bool css_tryget_online(struct cgroup_subsys_state *css) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
return percpu_ref_tryget_live(&css->refcnt); | ||
return true; | ||
} | ||
CGROUP_REF_EXPORT(css_tryget_online) | ||
|
||
/** | ||
* css_put - put a css reference | ||
* @css: target css | ||
* | ||
* Put a reference obtained via css_get() and css_tryget_online(). | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
void css_put(struct cgroup_subsys_state *css) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
percpu_ref_put(&css->refcnt); | ||
} | ||
CGROUP_REF_EXPORT(css_put) | ||
|
||
/** | ||
* css_put_many - put css references | ||
* @css: target css | ||
* @n: number of references to put | ||
* | ||
* Put references obtained via css_get() and css_tryget_online(). | ||
*/ | ||
CGROUP_REF_FN_ATTRS | ||
void css_put_many(struct cgroup_subsys_state *css, unsigned int n) | ||
{ | ||
if (!(css->flags & CSS_NO_REF)) | ||
percpu_ref_put_many(&css->refcnt, n); | ||
} | ||
CGROUP_REF_EXPORT(css_put_many) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.