All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nadia Derbey <Nadia.Derbey@bull.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: manfred@colorfullife.com, paulmck@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org, efault@gmx.de
Subject: Re: [PATCH 01/10] Fix idr_remove()
Date: Mon, 05 May 2008 11:26:49 +0200	[thread overview]
Message-ID: <481ED2D9.3040801@bull.net> (raw)
In-Reply-To: <20080429114425.ea0e2f62.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Tue, 29 Apr 2008 16:33:05 +0200
> Nadia.Derbey@bull.net wrote:
> 
> 
>>[PATCH 01/10]
>>
>>This patch fixes idr_remove(): the return inside the loop makes us free only
>>a single layer.
>>
>>Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
>>
>>---
>> lib/idr.c |    2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>Index: linux-2.6.25-mm1/lib/idr.c
>>===================================================================
>>--- linux-2.6.25-mm1.orig/lib/idr.c	2008-04-25 15:29:00.000000000 +0200
>>+++ linux-2.6.25-mm1/lib/idr.c	2008-04-25 15:48:34.000000000 +0200
>>@@ -385,8 +385,8 @@ void idr_remove(struct idr *idp, int id)
>> 	while (idp->id_free_cnt >= IDR_FREE_MAX) {
>> 		p = alloc_layer(idp);
>> 		kmem_cache_free(idr_layer_cache, p);
>>-		return;
>> 	}
>>+	return;
>> }
>> EXPORT_SYMBOL(idr_remove);
> 
> 
> erk, ancient bug.
> 
> I _think_ the implications of this are that an idr tree will grow fatter
> than it needs to be, but there is no permanent leak: idr_destroy() will
> still free everything, yes?

Yes, exactly. Actually, I've not checked whether all the kernel 
components call idr_destroy() when needed.

> 
> And a consequence of the fix is that idr manipulations will now result in
> more allocs and frees,

Not necessarily more allocs: this loop keeps IDR_FREE_MAX layers in the 
free list. So idr_pre_get() should be a noop.

> but the amount of memory which a tree uses will be
> less?
> 
> 
> 

Regards,
Nadia



  reply	other threads:[~2008-05-05  9:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29 14:33 [PATCH 00/10] Scalability requirements for sysv ipc - v2 Nadia.Derbey
2008-04-29 14:33 ` [PATCH 01/10] Fix idr_remove() Nadia.Derbey
2008-04-29 18:44   ` Andrew Morton
2008-05-05  9:26     ` Nadia Derbey [this message]
2008-04-29 14:33 ` [PATCH 02/10] Introduce the ridr structure Nadia.Derbey
2008-05-01  4:30   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 03/10] Introduce ridr_pre_get() Nadia.Derbey
2008-05-01  4:31   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 04/10] Introduce ridr_init() Nadia.Derbey
2008-05-01  4:31   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 05/10] Introduce ridr_get_new_above() Nadia.Derbey
2008-05-01  4:32   ` Tim Pepper
2008-05-05 10:33     ` Nadia Derbey
2008-04-29 14:33 ` [PATCH 06/10] Introduce ridr_get_new() Nadia.Derbey
2008-05-01  4:32   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 07/10] Introduce ridr_find() Nadia.Derbey
2008-05-01  4:32   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 08/10] Introduce ridr_remove() Nadia.Derbey
2008-05-01  4:32   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 09/10] Integrate the ridr code into IPC code Nadia.Derbey
2008-05-01  4:32   ` Tim Pepper
2008-04-29 14:33 ` [PATCH 10/10] Get rid of ipc_lock_down() Nadia.Derbey
2008-05-01  4:33   ` Tim Pepper
2008-04-29 18:54 ` [PATCH 00/10] Scalability requirements for sysv ipc - v2 Andrew Morton
2008-05-05 16:52   ` Nadia Derbey
2008-05-05 17:07     ` Andrew Morton

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=481ED2D9.3040801@bull.net \
    --to=nadia.derbey@bull.net \
    --cc=akpm@linux-foundation.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --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.