All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nadia.Derbey@bull.net
To: manfred@colorfullife.com, paulmck@linux.vnet.ibm.com,
	lnxninja@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org, efault@gmx.de,
	akpm@linux-foundation.org, Nadia Derbey <Nadia.Derbey@bull.net>
Subject: [PATCH 8/9] Call idr_find() without locking in ipc_lock()
Date: Wed, 07 May 2008 13:36:01 +0200	[thread overview]
Message-ID: <20080507113737.964082000@bull.net> (raw)
In-Reply-To: 20080507113553.395937000@bull.net

[-- Attachment #1: ipc_fix_ipc_lock.patch --]
[-- Type: text/plain, Size: 1354 bytes --]

[PATCH 08/09]

This patch makes idr_find() called locklessly in ipc_lock(), since the idr
tree is now RCU protected.

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>

---
 ipc/util.c |    9 ---------
 1 file changed, 9 deletions(-)

Index: linux-2.6.25-mm1/ipc/util.c
===================================================================
--- linux-2.6.25-mm1.orig/ipc/util.c	2008-05-06 17:15:10.000000000 +0200
+++ linux-2.6.25-mm1/ipc/util.c	2008-05-07 09:56:20.000000000 +0200
@@ -688,10 +688,6 @@ void ipc64_perm_to_ipc_perm (struct ipc6
  * Look for an id in the ipc ids idr and lock the associated ipc object.
  *
  * The ipc object is locked on exit.
- *
- * This is the routine that should be called when the rw_mutex is not already
- * held, i.e. idr tree not protected: it protects the idr tree in read mode
- * during the idr_find().
  */
 
 struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
@@ -699,18 +695,13 @@ struct kern_ipc_perm *ipc_lock(struct ip
 	struct kern_ipc_perm *out;
 	int lid = ipcid_to_idx(id);
 
-	down_read(&ids->rw_mutex);
-
 	rcu_read_lock();
 	out = idr_find(&ids->ipcs_idr, lid);
 	if (out == NULL) {
 		rcu_read_unlock();
-		up_read(&ids->rw_mutex);
 		return ERR_PTR(-EINVAL);
 	}
 
-	up_read(&ids->rw_mutex);
-
 	spin_lock(&out->lock);
 	
 	/* ipc_rmid() may have already freed the ID while ipc_lock

--

  parent reply	other threads:[~2008-05-07 11:41 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07 11:35 [PATCH 0/9] Scalability requirements for sysv ipc - v3 Nadia.Derbey
2008-05-07 11:35 ` [PATCH 1/9] Change the idr structure Nadia.Derbey
2008-05-08 17:12   ` Rik van Riel
2008-05-30  8:22   ` Paul E. McKenney
2008-05-07 11:35 ` [PATCH 2/9] Rename some of the idr APIs internal routines Nadia.Derbey
2008-05-08 17:15   ` Rik van Riel
2008-05-30  8:23   ` Paul E. McKenney
2008-05-07 11:35 ` [PATCH 3/9] Fix a printk call Nadia.Derbey
2008-05-08 17:43   ` Rik van Riel
2008-05-30  8:23   ` Paul E. McKenney
2008-05-07 11:35 ` [PATCH 4/9] Error checking factorization Nadia.Derbey
2008-05-08 17:45   ` Rik van Riel
2008-05-07 11:35 ` [PATCH 5/9] Make idr_get_new* rcu-safe Nadia.Derbey
2008-05-08 17:55   ` Rik van Riel
2008-05-30  8:23   ` Paul E. McKenney
2008-05-07 11:35 ` [PATCH 6/9] Make idr_find rcu-safe Nadia.Derbey
2008-05-08 17:58   ` Rik van Riel
2008-05-30  8:24   ` Paul E. McKenney
2008-05-07 11:36 ` [PATCH 7/9] Make idr_remove rcu-safe Nadia.Derbey
2008-05-08 18:02   ` Rik van Riel
2008-05-14 19:59   ` Tim Pepper
2008-05-15  7:40     ` Nadia Derbey
2008-05-20  5:29       ` Tim Pepper
2008-05-20  5:35         ` Tim Pepper
2008-05-20  7:03         ` Nadia Derbey
2008-05-20 16:26           ` Tim Pepper
2008-05-30  8:24   ` Paul E. McKenney
2008-05-07 11:36 ` Nadia.Derbey [this message]
2008-05-08 18:11   ` [PATCH 8/9] Call idr_find() without locking in ipc_lock() Rik van Riel
2008-05-30  8:27   ` Paul E. McKenney
2008-05-07 11:36 ` [PATCH 9/9] Get rid of ipc_lock_down() Nadia.Derbey
2008-05-08 18:13   ` Rik van Riel
2008-05-30  8:29   ` Paul E. McKenney
2008-05-07 11:41 ` [PATCH 0/9] Scalability requirements for sysv ipc - v3 Nadia Derbey
2008-05-07 13:19 ` KOSAKI Motohiro
2008-05-13 14:10   ` Nadia Derbey
2008-05-14  4:22     ` KOSAKI Motohiro
2008-05-30  8:22 ` Paul E. McKenney
2008-06-02  5:53   ` Nadia Derbey

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=20080507113737.964082000@bull.net \
    --to=nadia.derbey@bull.net \
    --cc=akpm@linux-foundation.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lnxninja@linux.vnet.ibm.com \
    --cc=manfred@colorfullife.com \
    --cc=paulmck@linux.vnet.ibm.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 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.