* + mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch added to -mm tree
@ 2009-04-24 20:08 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2009-04-24 20:08 UTC (permalink / raw)
To: mm-commits; +Cc: rpjday, hannes, matthew, penberg
The patch titled
mm: rewrite some tests with is_power_of_2() for clarity.
has been added to the -mm tree. Its filename is
mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: mm: rewrite some tests with is_power_of_2() for clarity.
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
Replace some conditional tests with the semantically clearer call to
is_power_of_2().
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/bootmem.c | 3 ++-
mm/dmapool.c | 5 +++--
mm/slub.c | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff -puN mm/bootmem.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/bootmem.c
--- a/mm/bootmem.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/bootmem.c
@@ -12,6 +12,7 @@
#include <linux/pfn.h>
#include <linux/bootmem.h>
#include <linux/module.h>
+#include <linux/log2.h>
#include <asm/bug.h>
#include <asm/io.h>
@@ -438,7 +439,7 @@ static void * __init alloc_bootmem_core(
align, goal, limit);
BUG_ON(!size);
- BUG_ON(align & (align - 1));
+ BUG_ON(!is_power_of_2(align));
BUG_ON(limit && goal + size > limit);
if (!bdata->node_bootmem_map)
diff -puN mm/dmapool.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/dmapool.c
--- a/mm/dmapool.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/dmapool.c
@@ -36,6 +36,7 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
+#include <linux/log2.h>
#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB_DEBUG_ON)
#define DMAPOOL_DEBUG 1
@@ -135,7 +136,7 @@ struct dma_pool *dma_pool_create(const c
if (align == 0) {
align = 1;
- } else if (align & (align - 1)) {
+ } else if (!is_power_of_2(align)) {
return NULL;
}
@@ -152,7 +153,7 @@ struct dma_pool *dma_pool_create(const c
if (!boundary) {
boundary = allocation;
- } else if ((boundary < size) || (boundary & (boundary - 1))) {
+ } else if ((boundary < size) || !is_power_of_2(boundary)) {
return NULL;
}
diff -puN mm/slub.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/slub.c
--- a/mm/slub.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/slub.c
@@ -27,6 +27,7 @@
#include <linux/memory.h>
#include <linux/math64.h>
#include <linux/fault-inject.h>
+#include <linux/log2.h>
/*
* Lock order:
@@ -3060,7 +3061,7 @@ void __init kmem_cache_init(void)
* around with ARCH_KMALLOC_MINALIGN
*/
BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 ||
- (KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1)));
+ (!is_power_of_2(KMALLOC_MIN_SIZE)));
for (i = 8; i < KMALLOC_MIN_SIZE; i += 8)
size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW;
_
Patches currently in -mm which might be from rpjday@crashcourse.ca are
origin.patch
linux-next.patch
kvm-expand-on-help-info-to-specify-kvm-intel-and-amd-module-names.patch
mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch added to -mm tree
@ 2009-04-24 20:07 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2009-04-24 20:07 UTC (permalink / raw)
To: mm-commits; +Cc: rpjday, matthew, penberg
The patch titled
mm: rewrite some tests with is_power_of_2() for clarity.
has been added to the -mm tree. Its filename is
mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: mm: rewrite some tests with is_power_of_2() for clarity.
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
Replace some conditional tests with the semantically clearer call to
is_power_of_2().
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/bootmem.c | 3 ++-
mm/dmapool.c | 5 +++--
mm/slub.c | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff -puN mm/bootmem.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/bootmem.c
--- a/mm/bootmem.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/bootmem.c
@@ -12,6 +12,7 @@
#include <linux/pfn.h>
#include <linux/bootmem.h>
#include <linux/module.h>
+#include <linux/log2.h>
#include <asm/bug.h>
#include <asm/io.h>
@@ -438,7 +439,7 @@ static void * __init alloc_bootmem_core(
align, goal, limit);
BUG_ON(!size);
- BUG_ON(align & (align - 1));
+ BUG_ON(!is_power_of_2(align));
BUG_ON(limit && goal + size > limit);
if (!bdata->node_bootmem_map)
diff -puN mm/dmapool.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/dmapool.c
--- a/mm/dmapool.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/dmapool.c
@@ -36,6 +36,7 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
+#include <linux/log2.h>
#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB_DEBUG_ON)
#define DMAPOOL_DEBUG 1
@@ -135,7 +136,7 @@ struct dma_pool *dma_pool_create(const c
if (align == 0) {
align = 1;
- } else if (align & (align - 1)) {
+ } else if (!is_power_of_2(align)) {
return NULL;
}
@@ -152,7 +153,7 @@ struct dma_pool *dma_pool_create(const c
if (!boundary) {
boundary = allocation;
- } else if ((boundary < size) || (boundary & (boundary - 1))) {
+ } else if ((boundary < size) || !is_power_of_2(boundary)) {
return NULL;
}
diff -puN mm/slub.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity mm/slub.c
--- a/mm/slub.c~mm-rewrite-some-tests-with-is_power_of_2-for-clarity
+++ a/mm/slub.c
@@ -27,6 +27,7 @@
#include <linux/memory.h>
#include <linux/math64.h>
#include <linux/fault-inject.h>
+#include <linux/log2.h>
/*
* Lock order:
@@ -3060,7 +3061,7 @@ void __init kmem_cache_init(void)
* around with ARCH_KMALLOC_MINALIGN
*/
BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 ||
- (KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1)));
+ (!is_power_of_2(KMALLOC_MIN_SIZE)));
for (i = 8; i < KMALLOC_MIN_SIZE; i += 8)
size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW;
_
Patches currently in -mm which might be from rpjday@crashcourse.ca are
origin.patch
linux-next.patch
kvm-expand-on-help-info-to-specify-kvm-intel-and-amd-module-names.patch
mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-24 20:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 20:08 + mm-rewrite-some-tests-with-is_power_of_2-for-clarity.patch added to -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2009-04-24 20:07 akpm
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.