mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>, Lai Jiangshan <laijs@cn.fujitsu.com>,
	Jean Delvare <jdelvare@suse.de>,
	Monam Agarwal <monamagarwal123@gmail.com>,
	Jeff Layton <jlayton@redhat.com>,
	Andreas Gruenbacher <agruen@linbit.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 5/7 V3] idr: don't need to shink the free list when idr_remove()
Date: Tue, 22 Apr 2014 14:23:27 +0800	[thread overview]
Message-ID: <1398147810-26414-6-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1398147810-26414-1-git-send-email-laijs@cn.fujitsu.com>

After idr subsystem is changed to RCU-awared, the free layer will not go to
the free list. The free list will not be filled up when idr_remove().
So we don't need to shink it too.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Tejun Heo <tj@kernel.org>
---
 lib/idr.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/lib/idr.c b/lib/idr.c
index e79e051..9ed37a7 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -18,12 +18,6 @@
  * pointer or what ever, we treat it as a (void *).  You can pass this
  * id to a user for him to pass back at a later time.  You then pass
  * that id to this code and it returns your pointer.
-
- * You can release ids at any time. When all ids are released, most of
- * the memory is returned (we keep MAX_IDR_FREE) in a local pool so we
- * don't need to go to the memory "store" during an id allocate, just
- * so you don't need to be too concerned about locking and conflicts
- * with the slab allocator.
  */
 
 #ifndef TEST                        // to test in user space...
@@ -584,16 +578,6 @@ void idr_remove(struct idr *idp, int id)
 		bitmap_clear(to_free->bitmap, 0, IDR_SIZE);
 		free_layer(idp, to_free);
 	}
-	while (idp->id_free_cnt >= MAX_IDR_FREE) {
-		p = get_from_free_list(idp);
-		/*
-		 * Note: we don't call the rcu callback here, since the only
-		 * layers that fall into the freelist are those that have been
-		 * preallocated.
-		 */
-		kmem_cache_free(idr_layer_cache, p);
-	}
-	return;
 }
 EXPORT_SYMBOL(idr_remove);
 
-- 
1.7.4.4


  parent reply	other threads:[~2014-04-22  6:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140421152345.4d67a6563ebd89f0b969332f@linux-foundation.org>
2014-04-22  6:23 ` [PATCH 0/7 V3] idr: fix & cleanup Lai Jiangshan
2014-04-22  6:23   ` [PATCH 1/7 V3] idr: fix overflow bug during maximum ID calculation at maximum height Lai Jiangshan
2014-04-22  6:23   ` [PATCH 2/7 V3] idr: fix unexpected ID-removal when idr_remove(unallocated_id) Lai Jiangshan
2014-04-22  6:23   ` [PATCH 3/7 V3] idr: fix NULL pointer dereference when ida_remove(unallocated_id) Lai Jiangshan
2014-04-22  6:23   ` [PATCH 4/7 V3] idr: fix idr_replace()'s returned error code Lai Jiangshan
2014-04-22  6:23   ` Lai Jiangshan [this message]
2014-04-22  6:23   ` [PATCH 6/7 V3] idr: reduce the unneeded check in free_layer() Lai Jiangshan
2014-04-22  6:23   ` [PATCH 7/7 V3] idr: remove useless #ifndef TEST Lai Jiangshan

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=1398147810-26414-6-git-send-email-laijs@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=agruen@linbit.com \
    --cc=akpm@linux-foundation.org \
    --cc=jdelvare@suse.de \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monamagarwal123@gmail.com \
    --cc=stephen@networkplumber.org \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®