Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbeAQJW4 (ORCPT + 1 other); Wed, 17 Jan 2018 04:22:56 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:16542 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752228AbeAQJWu (ORCPT ); Wed, 17 Jan 2018 04:22:50 -0500 Message-Id: <5b2e7ea5b11e11034817467a142a9bd01dc22725.1516179904.git.christophe.leroy@c-s.fr> In-Reply-To: <49148d07955d3e5f963cedf9adcfcc37c3e03ef4.1516179904.git.christophe.leroy@c-s.fr> References: <49148d07955d3e5f963cedf9adcfcc37c3e03ef4.1516179904.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 5/5] powerpc/mm: Remove intermediate bitmap copy in 'slices' To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , aneesh.kumar@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 17 Jan 2018 10:22:48 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- 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