From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Subject: [PATCH] sysctl: use bitmap library functions
Date: Sat, 21 Jan 2012 00:15:28 +0900 [thread overview]
Message-ID: <1327072528-8479-6-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1327072528-8479-1-git-send-email-akinobu.mita@gmail.com>
Use bitmap_set() instead of using set_bit() for each bit. This conversion
is valid because the bitmap is private in the function call and atomic
bitops was unnecessary.
This also includes minor change.
- Use bitmap_copy() for shorter typing
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
kernel/sysctl.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f487f25..57c92a7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -58,6 +58,7 @@
#include <linux/oom.h>
#include <linux/kmod.h>
#include <linux/capability.h>
+#include <linux/bitmap.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
@@ -2884,9 +2885,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
}
}
- while (val_a <= val_b)
- set_bit(val_a++, tmp_bitmap);
-
+ bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
first = 0;
proc_skip_char(&kbuf, &left, '\n');
}
@@ -2929,8 +2928,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
if (*ppos)
bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
else
- memcpy(bitmap, tmp_bitmap,
- BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
+ bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
}
kfree(tmp_bitmap);
*lenp -= left;
--
1.7.4.4
next prev parent reply other threads:[~2012-01-20 15:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 15:15 [PATCH] percpu: use bitmap_clear Akinobu Mita
2012-01-20 15:15 ` [PATCH] ocfs2: use find_last_bit Akinobu Mita
2012-01-20 15:15 ` [PATCH] ocfs2: use bitmap_weight() Akinobu Mita
2012-01-20 15:15 ` [PATCH] xen-blkfront: use bitmap_set() and bitmap_clear() Akinobu Mita
2012-01-20 15:27 ` Akinobu Mita
2012-01-20 15:28 ` Konrad Rzeszutek Wilk
2012-01-20 15:41 ` Akinobu Mita
2012-01-20 16:09 ` Konrad Rzeszutek Wilk
2012-01-20 23:11 ` Andrew Morton
2012-01-20 23:55 ` Konrad Rzeszutek Wilk
2012-01-21 0:04 ` Andrew Morton
2012-01-20 15:15 ` [PATCH] hpsa: use find_first_zero_bit Akinobu Mita
2012-01-20 15:41 ` scameron
2012-01-20 15:15 ` Akinobu Mita [this message]
2012-01-20 15:19 ` [PATCH] percpu: use bitmap_clear Christoph Lameter
2012-01-20 17:24 ` 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=1327072528-8479-6-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.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®