From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758956Ab3BSXpU (ORCPT ); Tue, 19 Feb 2013 18:45:20 -0500 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:51657 "EHLO LGEMRELSE6Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758700Ab3BSXpS (ORCPT ); Tue, 19 Feb 2013 18:45:18 -0500 X-AuditID: 9c930179-b7c24ae00000119c-36-51240e8ca0f6 Date: Wed, 20 Feb 2013 08:45:16 +0900 From: Minchan Kim To: Simon Jeons Cc: Greg Kroah-Hartman , Matt Sealey , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dan Magenheimer , Russell King , Konrad Rzeszutek Wilk , Nitin Gupta , Seth Jennings Subject: Re: [PATCH] zsmalloc: Fix TLB coherency and build problem Message-ID: <20130219234516.GB16950@blaptop> References: <1359334808-19794-1-git-send-email-minchan@kernel.org> <51234EEC.3010700@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51234EEC.3010700@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2013 at 06:07:40PM +0800, Simon Jeons wrote: > On 01/28/2013 09:00 AM, Minchan Kim wrote: > >Recently, Matt Sealey reported he fail to build zsmalloc caused by > >using of local_flush_tlb_kernel_range which are architecture dependent > >function so !CONFIG_SMP in ARM couldn't implement it so it ends up > >build error following as. > > Confuse me! > > 1) Why I see flush_tlb_kernel_range is different in different architecture? IMHO, all architecture can do their best effort by thier own way. > 2) Does local here means local cpu? If the answer is yes, why ARM Yes. > doesn't support it? ARM supports it for some configuration and CPUs. The thing is that every architecture doesn't support so it's not a generic API. It means we should avoid it in general layer. > > > > > MODPOST 216 modules > > LZMA arch/arm/boot/compressed/piggy.lzma > > AS arch/arm/boot/compressed/lib1funcs.o > >ERROR: "v7wbi_flush_kern_tlb_range" > >[drivers/staging/zsmalloc/zsmalloc.ko] undefined! > >make[1]: *** [__modpost] Error 1 > >make: *** [modules] Error 2 > >make: *** Waiting for unfinished jobs.... > > > >The reason we used that function is copy method by [1] > >was really slow in ARM but at that time. > > > >More severe problem is ARM can prefetch speculatively on other CPUs > >so under us, other TLBs can have an entry only if we do flush local > >CPU. Russell King pointed that. Thanks! > >We don't have many choices except using flush_tlb_kernel_range. > > > >My experiment in ARMv7 processor 4 core didn't make any difference with > >zsmapbench[2] between local_flush_tlb_kernel_range and flush_tlb_kernel_range > >but still page-table based is much better than copy-based. > > > >* bigger is better. > > > >1. local_flush_tlb_kernel_range: 3918795 mappings > >2. flush_tlb_kernel_range : 3989538 mappings > >3. copy-based: 635158 mappings > > > >This patch replace local_flush_tlb_kernel_range with > >flush_tlb_kernel_range which are avaialbe in all architectures > >because we already have used it in vmalloc allocator which are > >generic one so build problem should go away and performane loss > >shoud be void. > > > >[1] f553646, zsmalloc: add page table mapping method > >[2] https://github.com/spartacus06/zsmapbench > > > >Cc: stable@vger.kernel.org > >Cc: Dan Magenheimer > >Cc: Russell King > >Cc: Konrad Rzeszutek Wilk > >Cc: Nitin Gupta > >Cc: Seth Jennings > >Reported-by: Matt Sealey > >Signed-off-by: Minchan Kim > >--- > > > >Matt, Could you test this patch? > > > > drivers/staging/zsmalloc/zsmalloc-main.c | 10 ++++------ > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > >diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c > >index eb00772..82e627c 100644 > >--- a/drivers/staging/zsmalloc/zsmalloc-main.c > >+++ b/drivers/staging/zsmalloc/zsmalloc-main.c > >@@ -222,11 +222,9 @@ struct zs_pool { > > /* > > * By default, zsmalloc uses a copy-based object mapping method to access > > * allocations that span two pages. However, if a particular architecture > >- * 1) Implements local_flush_tlb_kernel_range() and 2) Performs VM mapping > >- * faster than copying, then it should be added here so that > >- * USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use page table > >- * mapping rather than copying > >- * for object mapping. > >+ * performs VM mapping faster than copying, then it should be added here > >+ * so that USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use > >+ * page table mapping rather than copying for object mapping. > > */ > > #if defined(CONFIG_ARM) > > #define USE_PGTABLE_MAPPING > >@@ -663,7 +661,7 @@ static inline void __zs_unmap_object(struct mapping_area *area, > > flush_cache_vunmap(addr, end); > > unmap_kernel_range_noflush(addr, PAGE_SIZE * 2); > >- local_flush_tlb_kernel_range(addr, end); > >+ flush_tlb_kernel_range(addr, end); > > } > > #else /* USE_PGTABLE_MAPPING */ > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org -- Kind regards, Minchan Kim