Thread (21 messages) flat view 21 messages, 4 authors, 2018-01-27
STALE3151d

[PATCH v2 5/5] powerpc/mm: Remove intermediate bitmap copy in 'slices'

From: Christophe Leroy <hidden>
Date: 2018-01-17 09:22:56
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

bitmap_or() and bitmap_andnot() can work properly with dst identical
to src1 or src2. There is no need of an intermediate result bitmap
that is copied back to dst in a second step.

Signed-off-by: Christophe Leroy <redacted>
---
 v2: New in v2

 arch/powerpc/mm/slice.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index fa6f7f63223c..9d88b1c03caa 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -72,8 +72,6 @@ static void slice_print_mask(const char *label, struct slice_mask mask) {}
 	do { if (nbits) bitmap_zero(dst, nbits); } while (0)
 #define slice_bitmap_set(dst, pos, nbits) \
 	do { if (nbits) bitmap_set(dst, pos, nbits); } while (0)
-#define slice_bitmap_copy(dst, src, nbits) \
-	do { if (nbits) bitmap_copy(dst, src, nbits); } while (0)
 #define slice_bitmap_and(dst, src1, src2, nbits) \
 	({ (nbits) ? bitmap_and(dst, src1, src2, nbits) : 0; })
 #define slice_bitmap_or(dst, src1, src2, nbits) \
@@ -416,25 +414,18 @@ static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len,
 
 static inline void slice_or_mask(struct slice_mask *dst, struct slice_mask *src)
 {
-	DECLARE_BITMAP(result, SLICE_NUM_HIGH);
-
 	slice_bitmap_or(dst->low_slices, dst->low_slices, src->low_slices,
 			SLICE_NUM_LOW);
-	slice_bitmap_or(result, dst->high_slices, src->high_slices,
+	slice_bitmap_or(dst->high_slices, dst->high_slices, src->high_slices,
 			SLICE_NUM_HIGH);
-	slice_bitmap_copy(dst->high_slices, result, SLICE_NUM_HIGH);
 }
 
 static inline void slice_andnot_mask(struct slice_mask *dst, struct slice_mask *src)
 {
-	DECLARE_BITMAP(result, SLICE_NUM_HIGH);
-
 	slice_bitmap_andnot(dst->low_slices, dst->low_slices, src->low_slices,
 			    SLICE_NUM_LOW);
-
-	slice_bitmap_andnot(result, dst->high_slices, src->high_slices,
-			    SLICE_NUM_HIGH);
-	slice_bitmap_copy(dst->high_slices, result, SLICE_NUM_HIGH);
+	slice_bitmap_andnot(dst->high_slices, dst->high_slices,
+			    src->high_slices, SLICE_NUM_HIGH);
 }
 
 #ifdef CONFIG_PPC_64K_PAGES
-- 
2.13.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help