From patchwork Wed Jan 17 09:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 862119 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zM1x26ws0z9s82 for ; Wed, 17 Jan 2018 20:28:38 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zM1x22nb6zDqJw for ; Wed, 17 Jan 2018 20:28:38 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=c-s.fr (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@c-s.fr; receiver=) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zM1pN2x0YzF0Wk for ; Wed, 17 Jan 2018 20:22:52 +1100 (AEDT) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3zM1p65bSWz9ttv9; Wed, 17 Jan 2018 10:22:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id oxaiU4fc6mNn; Wed, 17 Jan 2018 10:22:38 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3zM1p64rFXz9ttv1; Wed, 17 Jan 2018 10:22:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id EDD908B8A8; Wed, 17 Jan 2018 10:22:48 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 65IHXn11Zo5j; Wed, 17 Jan 2018 10:22:48 +0100 (CET) Received: from PO15451.localdomain (po15451.idsi0.si.c-s.fr [172.25.231.40]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C13318B8A6; Wed, 17 Jan 2018 10:22:48 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id B00AD6EEEE; Wed, 17 Jan 2018 10:22:48 +0100 (CET) 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 Date: Wed, 17 Jan 2018 10:22:48 +0100 (CET) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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