linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Scott Wood <oss@buserror.net>,
	aneesh.kumar@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 5/5] powerpc/mm: Remove intermediate bitmap copy in 'slices'
Date: Wed, 17 Jan 2018 10:22:48 +0100 (CET)	[thread overview]
Message-ID: <5b2e7ea5b11e11034817467a142a9bd01dc22725.1516179904.git.christophe.leroy@c-s.fr> (raw)
In-Reply-To: <49148d07955d3e5f963cedf9adcfcc37c3e03ef4.1516179904.git.christophe.leroy@c-s.fr>

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 <christophe.leroy@c-s.fr>
---
 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

  parent reply	other threads:[~2018-01-17  9:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  9:22 [PATCH v2 1/5] powerpc/mm: Enhance 'slice' for supporting PPC32 Christophe Leroy
2018-01-17  9:22 ` [PATCH v2 2/5] powerpc/32: Fix hugepage allocation on 8xx at hint address Christophe Leroy
2018-01-19  8:26   ` Aneesh Kumar K.V
2018-01-19  8:49     ` Christophe LEROY
2018-01-27  9:37     ` Michael Ellerman
2018-01-17  9:22 ` [PATCH v2 3/5] powerpc/mm: Allow more than 16 low slices Christophe Leroy
2018-01-19  8:30   ` Aneesh Kumar K.V
2018-01-19  8:59     ` Christophe LEROY
2018-01-19  9:06       ` Aneesh Kumar K.V
2018-01-17  9:22 ` [PATCH v2 4/5] powerpc/8xx: Increase the number of mm slices Christophe Leroy
2018-01-17  9:22 ` Christophe Leroy [this message]
2018-01-19  8:24 ` [PATCH v2 1/5] powerpc/mm: Enhance 'slice' for supporting PPC32 Aneesh Kumar K.V
2018-01-19  8:44   ` Christophe LEROY
2018-01-19  9:02     ` Aneesh Kumar K.V
2018-01-19  9:07       ` Christophe LEROY
2018-01-19  9:13         ` Aneesh Kumar K.V
2018-01-19  9:45           ` Christophe LEROY
2018-01-20  8:22             ` christophe leroy
2018-01-20 17:56               ` Segher Boessenkool
2018-01-22  7:52                 ` Christophe LEROY
2018-01-23 21:47                   ` Segher Boessenkool

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=5b2e7ea5b11e11034817467a142a9bd01dc22725.1516179904.git.christophe.leroy@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=oss@buserror.net \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).