From: Nadia Derbey <Nadia.Derbey@bull.net>
To: Tim Pepper <lnxninja@linux.vnet.ibm.com>
Cc: manfred@colorfullife.com, paulmck@linux.vnet.ibm.com,
linux-kernel@vger.kernel.org, efault@gmx.de,
akpm@linux-foundation.org
Subject: Re: [PATCH 7/9] Make idr_remove rcu-safe
Date: Thu, 15 May 2008 09:40:13 +0200 [thread overview]
Message-ID: <482BE8DD.2020101@bull.net> (raw)
In-Reply-To: <20080514195925.GA8994@tpepper-t42p.dolavim.us>
Tim Pepper wrote:
> On Wed 07 May at 13:36:00 +0200 Nadia.Derbey@bull.net said:
>
>>[PATCH 07/09]
>>
>>This patch introduces the free_layer() routine: it is the one that actually
>>frees memory after a grace period has elapsed.
>>
>>Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
>>
>>---
>> lib/idr.c | 59 ++++++++++++++++++++++++++++++++++++++++++++---------------
>> 1 file changed, 44 insertions(+), 15 deletions(-)
>>
>>Index: linux-2.6.25-mm1/lib/idr.c
>>===================================================================
>>--- linux-2.6.25-mm1.orig/lib/idr.c 2008-05-06 18:06:43.000000000 +0200
>>+++ linux-2.6.25-mm1/lib/idr.c 2008-05-07 09:07:31.000000000 +0200
>>@@ -424,15 +455,13 @@ void idr_remove_all(struct idr *idp)
>>
>> id += 1 << n;
>> while (n < fls(id)) {
>>- if (p) {
>>- memset(p, 0, sizeof *p);
>>- move_to_free_list(idp, p);
>>- }
>>+ if (p)
>>+ free_layer(p);
>> n += IDR_BITS;
>> p = *--paa;
>> }
>> }
>>- idp->top = NULL;
>>+ rcu_assign_pointer(idp->top, NULL);
>> idp->layers = 0;
>> }
>> EXPORT_SYMBOL(idr_remove_all);
>
>
> Does idr_remove_all() need an rcu_dereference() in the loop preceeding the
> above, where it does:
>
> while (n > IDR_BITS && p) {
> n -= IDR_BITS;
> *paa++ = p;
> ----> p = p->ary[(id >> n) & IDR_MASK];
> }
I assumed here that idr_remove_all() was called in the "typical cleanup
sequence" mentioned in the comment describing the routine.
And actually, that's how it is called in drivers/char/drm.
>
> idr_replace() also has that loop without rcu_derefernce, but I _think_
> I see why that one should be ok. At least there the comment is clear
> that locking at a higher level should be happening.
I didn't use rcu_dereference here since the caller should anyway
serialize with other writers. So the tree should remain unchanged during
the replace operation.
> And then
> idr_remove_all() is almost unused and it looks like it is only in
> serialized places.
>
> Otherwise, thanks for redoing...This patch set was much easier to digest
> and looks reasonable to me.
>
> I've been having some machine issues, but hope to give this patch set a run
> still on a 128way machine and mainline to provide some additional
> datapoints.
>
That would be kind, indeed (hope I didn't break anything).
Regards,
Nadia
next prev parent reply other threads:[~2008-05-15 7:40 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 [this message]
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 ` [PATCH 8/9] Call idr_find() without locking in ipc_lock() Nadia.Derbey
2008-05-08 18:11 ` 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=482BE8DD.2020101@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox