Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757338Ab2FYQmR (ORCPT ); Mon, 25 Jun 2012 12:42:17 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:42630 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756184Ab2FYQmQ (ORCPT ); Mon, 25 Jun 2012 12:42:16 -0400 From: Seth Jennings To: Greg Kroah-Hartman Cc: Seth Jennings , Andrew Morton , Dan Magenheimer , Konrad Rzeszutek Wilk , Nitin Gupta , Minchan Kim , Robert Jennings , linux-mm@kvack.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] x86: add local_tlb_flush_kernel_range() Date: Mon, 25 Jun 2012 11:14:38 -0500 Message-Id: <1340640878-27536-4-git-send-email-sjenning@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340640878-27536-1-git-send-email-sjenning@linux.vnet.ibm.com> References: <1340640878-27536-1-git-send-email-sjenning@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062516-3534-0000-0000-000009C8A2AC Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 48 This patch adds support for a local_tlb_flush_kernel_range() function for the x86 arch. This function allows for CPU-local TLB flushing, potentially using invlpg for single entry flushing, using an arch independent function name. Signed-off-by: Seth Jennings --- arch/x86/include/asm/tlbflush.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 36a1a2a..92a280b 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -168,4 +168,25 @@ static inline void flush_tlb_kernel_range(unsigned long start, flush_tlb_all(); } +#define __HAVE_LOCAL_FLUSH_TLB_KERNEL_RANGE +/* + * INVLPG_BREAK_EVEN_PAGES is the number of pages after which single tlb + * flushing becomes more costly than just doing a complete tlb flush. + * While this break even point varies among x86 hardware, tests have shown + * that 8 is a good generic value. +*/ +#define INVLPG_BREAK_EVEN_PAGES 8 +static inline void local_flush_tlb_kernel_range(unsigned long start, + unsigned long end) +{ + if (cpu_has_invlpg && + (end - start)/PAGE_SIZE <= INVLPG_BREAK_EVEN_PAGES) { + while (start < end) { + __flush_tlb_single(start); + start += PAGE_SIZE; + } + } else + local_flush_tlb(); +} + #endif /* _ASM_X86_TLBFLUSH_H */ -- 1.7.9.5 -- 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/