Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1230572

Re: [PATCH v2 20/25] powerpc32: Remove clear_pages() and define clear_page() inline

From Joakim Tjernlund <joakim.tjernlund@transmode.se>
Newsgroups linux.kernel
Subject Re: [PATCH v2 20/25] powerpc32: Remove clear_pages() and define clear_page() inline
Date 2015-09-22 20:00 +0200
Message-ID <qbA1d-46k-45@gated-at.bofh.it> (permalink)
References <qbz57-2KT-3@gated-at.bofh.it> <qbz5a-2KT-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Christophe

Really nice patchset!

On Tue, 2015-09-22 at 18:51 +0200, Christophe Leroy wrote:
> clear_pages() is never used, and PPC32 is the only architecture
> (still) having this function. Neither PPC64 nor any other
> architecture has it.
> 
> This patch removes clear_page() and move clear_page() function
> inline (same as PPC64) as it only is a few isns
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> No change in v2
> 
>  arch/powerpc/include/asm/page_32.h | 17 ++++++++++++++---
>  arch/powerpc/kernel/misc_32.S      | 16 ----------------
>  arch/powerpc/kernel/ppc_ksyms_32.c |  1 -
>  3 files changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
> index 68d73b2..6a8e179 100644
> --- a/arch/powerpc/include/asm/page_32.h
> +++ b/arch/powerpc/include/asm/page_32.h
> @@ -1,6 +1,8 @@
>  #ifndef _ASM_POWERPC_PAGE_32_H
>  #define _ASM_POWERPC_PAGE_32_H
>  
> +#include <asm/cache.h>
> +
>  #if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START != 0)
>  #if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) != 0
>  #error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIGN"
> @@ -36,9 +38,18 @@ typedef unsigned long long pte_basic_t;
>  typedef unsigned long pte_basic_t;
>  #endif
>  
> -struct page;
> -extern void clear_pages(void *page, int order);
> -static inline void clear_page(void *page) { clear_pages(page, 0); }
> +/*
> + * Clear page using the dcbz instruction, which doesn't cause any
> + * memory traffic (except to write out any cache lines which get
> + * displaced).  This only works on cacheable memory.
> + */
> +static inline void clear_page(void *addr)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i < PAGE_SIZE / L1_CACHE_BYTES; i++, addr += L1_CACHE_BYTES)
> +		dcbz(addr);
> +}

Does gcc manage to transform this into efficient asm?
Otherwise you could help gcc by using do { .. } while(--i); instead.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 20/25] powerpc32: Remove clear_pages() and define  clear_page() inline Christophe Leroy <christophe.leroy@c-s.fr> - 2015-09-22 19:00 +0200
  Re: [PATCH v2 20/25] powerpc32: Remove clear_pages() and define  clear_page() inline Joakim Tjernlund <joakim.tjernlund@transmode.se> - 2015-09-22 20:00 +0200
  Re: [PATCH v2 20/25] powerpc32: Remove clear_pages() and define  clear_page() inline Scott Wood <scottwood@freescale.com> - 2015-09-29 02:30 +0200

csiph-web