* [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-01-23 17:17 Jerry Snitselaar
[not found] ` <1358961426-8482-1-git-send-email-jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Jerry Snitselaar @ 2013-01-23 17:17 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A
Cc: aris-H+wXaHxf7aLQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA
commit 103a197 "security/device_cgroup: lock assert fails in
dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
but mutex can't be grabbed in rcu callback. Since there shouldn't be
any other references when css_free is called, mutex isn't needed for
list cleanup in devcgroup_css_free().
Signed-off-by: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
security/device_cgroup.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index d794abc..1c69e38 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
}
}
+static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
+{
+ struct dev_exception_item *ex, *tmp;
+
+ list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
+ list_del_rcu(&ex->list);
+ kfree_rcu(ex, rcu);
+ }
+}
+
/**
* dev_exception_clean - frees all entries of the exception list
* @dev_cgroup: dev_cgroup with the exception list to be cleaned
@@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
*/
static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
{
- struct dev_exception_item *ex, *tmp;
-
lockdep_assert_held(&devcgroup_mutex);
- list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
- list_del_rcu(&ex->list);
- kfree_rcu(ex, rcu);
- }
+ __dev_exception_clean(dev_cgroup);
}
/*
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
struct dev_cgroup *dev_cgroup;
dev_cgroup = cgroup_to_devcgroup(cgroup);
- mutex_lock(&devcgroup_mutex);
- dev_exception_clean(dev_cgroup);
- mutex_unlock(&devcgroup_mutex);
+ __dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
}
--
1.8.1.1.293.gfe73786
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] device_cgroup: don't grab mutex in rcu callback
[not found] ` <1358961426-8482-1-git-send-email-jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2013-01-23 17:18 ` Tejun Heo
2013-01-23 18:39 ` Aristeu Rozanski
1 sibling, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2013-01-23 17:18 UTC (permalink / raw)
To: Jerry Snitselaar
Cc: aris-H+wXaHxf7aLQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA
On Wed, Jan 23, 2013 at 10:17:06AM -0700, Jerry Snitselaar wrote:
> commit 103a197 "security/device_cgroup: lock assert fails in
> dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
> but mutex can't be grabbed in rcu callback. Since there shouldn't be
> any other references when css_free is called, mutex isn't needed for
> list cleanup in devcgroup_css_free().
>
> Signed-off-by: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] device_cgroup: don't grab mutex in rcu callback
[not found] ` <1358961426-8482-1-git-send-email-jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-01-23 17:18 ` Tejun Heo
@ 2013-01-23 18:39 ` Aristeu Rozanski
1 sibling, 0 replies; 8+ messages in thread
From: Aristeu Rozanski @ 2013-01-23 18:39 UTC (permalink / raw)
To: Jerry Snitselaar
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA
On Wed, Jan 23, 2013 at 10:17:06AM -0700, Jerry Snitselaar wrote:
> commit 103a197 "security/device_cgroup: lock assert fails in
> dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
> but mutex can't be grabbed in rcu callback. Since there shouldn't be
> any other references when css_free is called, mutex isn't needed for
> list cleanup in devcgroup_css_free().
Acked-by: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
Aristeu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-02-14 16:48 ` Tejun Heo
0 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2013-02-14 16:48 UTC (permalink / raw)
To: Jerry Snitselaar; +Cc: linux-kernel, cgroups, serge.hallyn, aris, Andrew Morton
(cc'ing Andrew)
Andrew, can you please pick up this one?
http://article.gmane.org/gmane.linux.kernel.cgroups/6158/raw
Thank you.
On Thu, Feb 14, 2013 at 09:46:03AM -0700, Jerry Snitselaar wrote:
> commit 103a197 "security/device_cgroup: lock assert fails in
> dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
> but mutex can't be grabbed in rcu callback. Since there shouldn't be
> any other references when css_free is called, mutex isn't needed for
> list cleanup in devcgroup_css_free().
>
> Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
> Acked-by: Tejun Heo <tj@kernel.org>
> Acked-by: Aristeu Rozanski <aris@redhat.com>
> ---
> security/device_cgroup.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> index d794abc..1c69e38 100644
> --- a/security/device_cgroup.c
> +++ b/security/device_cgroup.c
> @@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
> }
> }
>
> +static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
> +{
> + struct dev_exception_item *ex, *tmp;
> +
> + list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
> + list_del_rcu(&ex->list);
> + kfree_rcu(ex, rcu);
> + }
> +}
> +
> /**
> * dev_exception_clean - frees all entries of the exception list
> * @dev_cgroup: dev_cgroup with the exception list to be cleaned
> @@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
> */
> static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
> {
> - struct dev_exception_item *ex, *tmp;
> -
> lockdep_assert_held(&devcgroup_mutex);
>
> - list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
> - list_del_rcu(&ex->list);
> - kfree_rcu(ex, rcu);
> - }
> + __dev_exception_clean(dev_cgroup);
> }
>
> /*
> @@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
> struct dev_cgroup *dev_cgroup;
>
> dev_cgroup = cgroup_to_devcgroup(cgroup);
> - mutex_lock(&devcgroup_mutex);
> - dev_exception_clean(dev_cgroup);
> - mutex_unlock(&devcgroup_mutex);
> + __dev_exception_clean(dev_cgroup);
> kfree(dev_cgroup);
> }
>
> --
> 1.8.1.1.293.gfe73786
>
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-02-14 16:48 ` Tejun Heo
0 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2013-02-14 16:48 UTC (permalink / raw)
To: Jerry Snitselaar
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
cgroups-u79uwXL29TY76Z2rM5mHXA,
serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw, aris-H+wXaHxf7aLQT0dZR+AlfA,
Andrew Morton
(cc'ing Andrew)
Andrew, can you please pick up this one?
http://article.gmane.org/gmane.linux.kernel.cgroups/6158/raw
Thank you.
On Thu, Feb 14, 2013 at 09:46:03AM -0700, Jerry Snitselaar wrote:
> commit 103a197 "security/device_cgroup: lock assert fails in
> dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
> but mutex can't be grabbed in rcu callback. Since there shouldn't be
> any other references when css_free is called, mutex isn't needed for
> list cleanup in devcgroup_css_free().
>
> Signed-off-by: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Acked-by: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> security/device_cgroup.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> index d794abc..1c69e38 100644
> --- a/security/device_cgroup.c
> +++ b/security/device_cgroup.c
> @@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
> }
> }
>
> +static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
> +{
> + struct dev_exception_item *ex, *tmp;
> +
> + list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
> + list_del_rcu(&ex->list);
> + kfree_rcu(ex, rcu);
> + }
> +}
> +
> /**
> * dev_exception_clean - frees all entries of the exception list
> * @dev_cgroup: dev_cgroup with the exception list to be cleaned
> @@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
> */
> static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
> {
> - struct dev_exception_item *ex, *tmp;
> -
> lockdep_assert_held(&devcgroup_mutex);
>
> - list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
> - list_del_rcu(&ex->list);
> - kfree_rcu(ex, rcu);
> - }
> + __dev_exception_clean(dev_cgroup);
> }
>
> /*
> @@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
> struct dev_cgroup *dev_cgroup;
>
> dev_cgroup = cgroup_to_devcgroup(cgroup);
> - mutex_lock(&devcgroup_mutex);
> - dev_exception_clean(dev_cgroup);
> - mutex_unlock(&devcgroup_mutex);
> + __dev_exception_clean(dev_cgroup);
> kfree(dev_cgroup);
> }
>
> --
> 1.8.1.1.293.gfe73786
>
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-02-14 16:46 ` Jerry Snitselaar
0 siblings, 0 replies; 8+ messages in thread
From: Jerry Snitselaar @ 2013-02-14 16:46 UTC (permalink / raw)
To: linux-kernel; +Cc: cgroups, serge.hallyn, tj, aris
commit 103a197 "security/device_cgroup: lock assert fails in
dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
but mutex can't be grabbed in rcu callback. Since there shouldn't be
any other references when css_free is called, mutex isn't needed for
list cleanup in devcgroup_css_free().
Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Aristeu Rozanski <aris@redhat.com>
---
security/device_cgroup.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index d794abc..1c69e38 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
}
}
+static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
+{
+ struct dev_exception_item *ex, *tmp;
+
+ list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
+ list_del_rcu(&ex->list);
+ kfree_rcu(ex, rcu);
+ }
+}
+
/**
* dev_exception_clean - frees all entries of the exception list
* @dev_cgroup: dev_cgroup with the exception list to be cleaned
@@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
*/
static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
{
- struct dev_exception_item *ex, *tmp;
-
lockdep_assert_held(&devcgroup_mutex);
- list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
- list_del_rcu(&ex->list);
- kfree_rcu(ex, rcu);
- }
+ __dev_exception_clean(dev_cgroup);
}
/*
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
struct dev_cgroup *dev_cgroup;
dev_cgroup = cgroup_to_devcgroup(cgroup);
- mutex_lock(&devcgroup_mutex);
- dev_exception_clean(dev_cgroup);
- mutex_unlock(&devcgroup_mutex);
+ __dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
}
--
1.8.1.1.293.gfe73786
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-02-14 16:46 ` Jerry Snitselaar
0 siblings, 0 replies; 8+ messages in thread
From: Jerry Snitselaar @ 2013-02-14 16:46 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw, tj-DgEjT+Ai2ygdnm+yROfE0A,
aris-H+wXaHxf7aLQT0dZR+AlfA
commit 103a197 "security/device_cgroup: lock assert fails in
dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
but mutex can't be grabbed in rcu callback. Since there shouldn't be
any other references when css_free is called, mutex isn't needed for
list cleanup in devcgroup_css_free().
Signed-off-by: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Acked-by: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
security/device_cgroup.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index d794abc..1c69e38 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
}
}
+static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
+{
+ struct dev_exception_item *ex, *tmp;
+
+ list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
+ list_del_rcu(&ex->list);
+ kfree_rcu(ex, rcu);
+ }
+}
+
/**
* dev_exception_clean - frees all entries of the exception list
* @dev_cgroup: dev_cgroup with the exception list to be cleaned
@@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
*/
static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
{
- struct dev_exception_item *ex, *tmp;
-
lockdep_assert_held(&devcgroup_mutex);
- list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
- list_del_rcu(&ex->list);
- kfree_rcu(ex, rcu);
- }
+ __dev_exception_clean(dev_cgroup);
}
/*
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
struct dev_cgroup *dev_cgroup;
dev_cgroup = cgroup_to_devcgroup(cgroup);
- mutex_lock(&devcgroup_mutex);
- dev_exception_clean(dev_cgroup);
- mutex_unlock(&devcgroup_mutex);
+ __dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
}
--
1.8.1.1.293.gfe73786
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] device_cgroup: don't grab mutex in rcu callback
@ 2013-01-23 18:00 Jerry Snitselaar
0 siblings, 0 replies; 8+ messages in thread
From: Jerry Snitselaar @ 2013-01-23 18:00 UTC (permalink / raw)
To: jmorris; +Cc: tj, linux-kernel
commit 103a197 "security/device_cgroup: lock assert fails in
dev_exception_clean()" grabs devcgroup_mutex to fix assert failure,
but mutex can't be grabbed in rcu callback. Since there shouldn't be
any other references when css_free is called, mutex isn't needed for
list cleanup in devcgroup_css_free().
Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
Acked-by: Tejun Heo <tj@kernel.org>
---
security/device_cgroup.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index d794abc..1c69e38 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
}
}
+static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
+{
+ struct dev_exception_item *ex, *tmp;
+
+ list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
+ list_del_rcu(&ex->list);
+ kfree_rcu(ex, rcu);
+ }
+}
+
/**
* dev_exception_clean - frees all entries of the exception list
* @dev_cgroup: dev_cgroup with the exception list to be cleaned
@@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
*/
static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
{
- struct dev_exception_item *ex, *tmp;
-
lockdep_assert_held(&devcgroup_mutex);
- list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
- list_del_rcu(&ex->list);
- kfree_rcu(ex, rcu);
- }
+ __dev_exception_clean(dev_cgroup);
}
/*
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
struct dev_cgroup *dev_cgroup;
dev_cgroup = cgroup_to_devcgroup(cgroup);
- mutex_lock(&devcgroup_mutex);
- dev_exception_clean(dev_cgroup);
- mutex_unlock(&devcgroup_mutex);
+ __dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
}
--
1.8.1.1.293.gfe73786
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-14 16:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 17:17 [PATCH] device_cgroup: don't grab mutex in rcu callback Jerry Snitselaar
[not found] ` <1358961426-8482-1-git-send-email-jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-01-23 17:18 ` Tejun Heo
2013-01-23 18:39 ` Aristeu Rozanski
2013-01-23 18:00 Jerry Snitselaar
2013-02-14 16:46 Jerry Snitselaar
2013-02-14 16:46 ` Jerry Snitselaar
2013-02-14 16:48 ` Tejun Heo
2013-02-14 16:48 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.