Re: [PATCH v2 20/25] powerpc32: Remove clear_pages() and define clear_page() inline
flat view
From: Joakim Tjernlund <hidden>
Date: 2015-09-22 17:57:57
Also in:
lkml
Hi Christophe Really nice patchset! On Tue, 2015-09-22 at 18:51 +0200, Christophe Leroy wrote:
quoted hunk ↗ jump to hunk
clear_pages() is never used, and PPC32 is the only architecture (still) having this function. Neither PPC64 nor any other architecture has it. =20 This patch removes clear_page() and move clear_page() function inline (same as PPC64) as it only is a few isns =20 Signed-off-by: Christophe Leroy <redacted> --- No change in v2 =20 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(-) =20diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/as=
m/page_32.h
quoted hunk ↗ jump to hunk
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=20 +#include <asm/cache.h> + #if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START !=3D 0) #if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) !=3D 0 #error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIG=
N"
quoted hunk ↗ jump to hunk
@@ -36,9 +38,18 @@ typedef unsigned long long pte_basic_t; typedef unsigned long pte_basic_t; #endif=20 -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 =3D 0; i < PAGE_SIZE / L1_CACHE_BYTES; i++, addr +=3D L1_CACHE_B=
YTES)
+ dcbz(addr); +}
Does gcc manage to transform this into efficient asm?
Otherwise you could help gcc by using do { .. } while(--i); instead.