From: Namhyung Kim <namhyung@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ida: fix up bitmap size calculation
Date: Fri, 03 Sep 2010 03:07:16 +0900 [thread overview]
Message-ID: <87vd6o9fzf.fsf@gmail.com> (raw)
In-Reply-To: <AANLkTi=Ema3mTkU7J7XKqmntA+VDJizhBuDHHnZtV_9K@mail.gmail.com> (Namhyung Kim's message of "Fri, 3 Sep 2010 02:25:22 +0900")
Namhyung Kim <namhyung@gmail.com> writes:
> Got it. :-) I'll prepare new patch with that comment, then.
> Thank you for the explanation.
How about this?
>From 38866b19cdbf03d133c54a1f3b7d48279bdd4177 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@gmail.com>
Date: Fri, 3 Sep 2010 02:44:47 +0900
Subject: [PATCH] ida: document IDA_BITMAP_LONGS calculation
IDA_BITMAP_LONGS value is calculated take into account struct ida_bitmap
not to waste memory space. Comment it.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
include/linux/idr.h | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/linux/idr.h b/include/linux/idr.h
index e968db7..7807e4b 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -119,9 +119,16 @@ void idr_init(struct idr *idp);
* pointer isn't necessary.
*/
#define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */
+/*
+ * -1 is needed here to fit total chunk size into 128 bytes because
+ * struct ida_bitmap consists of nr_busy and bitmap. Since it is
+ * allocated by kmalloc(), chunk size should be matched with kmalloc
+ * size so that it will not waste memory.
+ */
#define IDA_BITMAP_LONGS (128 / sizeof(long) - 1)
-#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8)
+#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8)
+/* IDA bitmap chunk */
struct ida_bitmap {
long nr_busy;
unsigned long bitmap[IDA_BITMAP_LONGS];
--
1.7.2.2
next prev parent reply other threads:[~2010-09-02 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-02 17:00 [PATCH] ida: fix up bitmap size calculation Namhyung Kim
2010-09-02 17:20 ` Tejun Heo
2010-09-02 17:25 ` Namhyung Kim
2010-09-02 18:07 ` Namhyung Kim [this message]
2010-09-03 9:14 ` Tejun Heo
2010-09-03 9:26 ` Namhyung Kim
2010-09-03 9:29 ` 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=87vd6o9fzf.fsf@gmail.com \
--to=namhyung@gmail.com \
--cc=linux-kernel@vger.kernel.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 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.