mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: lizefan@huawei.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/7] cgroup: cgroup_idr_lock should be bh
Date: Fri,  9 May 2014 15:32:50 -0400	[thread overview]
Message-ID: <1399663975-315-3-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1399663975-315-1-git-send-email-tj@kernel.org>

cgroup_idr_remove() can be invoked from bh leading to lockdep
detecting possible AA deadlock (IN_BH/ON_BH).  Make the lock bh-safe.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/cgroup.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 95fc66b..e2ff925 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -203,9 +203,9 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
 	int ret;
 
 	idr_preload(gfp_mask);
-	spin_lock(&cgroup_idr_lock);
+	spin_lock_bh(&cgroup_idr_lock);
 	ret = idr_alloc(idr, ptr, start, end, gfp_mask);
-	spin_unlock(&cgroup_idr_lock);
+	spin_unlock_bh(&cgroup_idr_lock);
 	idr_preload_end();
 	return ret;
 }
@@ -214,17 +214,17 @@ static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id)
 {
 	void *ret;
 
-	spin_lock(&cgroup_idr_lock);
+	spin_lock_bh(&cgroup_idr_lock);
 	ret = idr_replace(idr, ptr, id);
-	spin_unlock(&cgroup_idr_lock);
+	spin_unlock_bh(&cgroup_idr_lock);
 	return ret;
 }
 
 static void cgroup_idr_remove(struct idr *idr, int id)
 {
-	spin_lock(&cgroup_idr_lock);
+	spin_lock_bh(&cgroup_idr_lock);
 	idr_remove(idr, id);
-	spin_unlock(&cgroup_idr_lock);
+	spin_unlock_bh(&cgroup_idr_lock);
 }
 
 /**
-- 
1.9.0


  parent reply	other threads:[~2014-05-09 19:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 19:32 [PATCHSET v2 cgroup/for-3.16] cgroup: post unified hierarchy fixes and updates Tejun Heo
2014-05-09 19:32 ` [PATCH 1/7] cgroup: fix offlining child waiting in cgroup_subtree_control_write() Tejun Heo
2014-05-09 19:32 ` Tejun Heo [this message]
2014-05-09 19:32 ` [PATCH 3/7] cgroup: css_release() shouldn't clear cgroup->subsys[] Tejun Heo
2014-05-09 19:32 ` [PATCH 4/7] cgroup: update and fix parsing of "cgroup.subtree_control" Tejun Heo
2014-05-13  3:51   ` Li Zefan
2014-05-13 15:18     ` Tejun Heo
2014-05-09 19:32 ` [PATCH 5/7] cgroup: use restart_syscall() for retries after offline waits in cgroup_subtree_control_write() Tejun Heo
2014-05-13  5:00   ` Li Zefan
2014-05-13 15:19     ` Tejun Heo
2014-05-09 19:32 ` [PATCH 6/7] cgroup: use release_agent_path_lock in cgroup_release_agent_show() Tejun Heo
2014-05-09 19:32 ` [PATCH 7/7] cgroup: rename css_tryget*() to css_tryget_online*() Tejun Heo
2014-05-09 19:47   ` [PATCH v2 " Tejun Heo
2014-05-13  6:35 ` [PATCHSET v2 cgroup/for-3.16] cgroup: post unified hierarchy fixes and updates Li Zefan
2014-05-13 16:12 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399663975-315-3-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome