From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: TLB and PTE coherency during munmap Date: Wed, 29 May 2013 23:04:35 +0100 Message-ID: References: <51A45861.1010008@gmail.com> <20130529122728.GA27176@twins.programming.kicks-ass.net> <51A5F7A7.5020604@synopsys.com> <20130529175125.GJ12193@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: In-Reply-To: <20130529175125.GJ12193@twins.programming.kicks-ass.net> Sender: owner-linux-mm@kvack.org To: Peter Zijlstra Cc: Vineet Gupta , Max Filippov , KAMEZAWA Hiroyuki , "linux-arch@vger.kernel.org" , linux-mm , Ralf Baechle , Chris Zankel , Marc Gauthier , linux-xtensa@linux-xtensa.org, Hugh Dickins List-Id: linux-arch.vger.kernel.org On 29 May 2013 18:51, Peter Zijlstra wrote: > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -384,6 +384,21 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table) > > #endif /* CONFIG_HAVE_RCU_TABLE_FREE */ > > +static inline void cond_resched_tlb(struct mmu_gather *tlb) > +{ > +#ifndef CONFIG_PREEMPT > + /* > + * For full preempt kernels we must do regular batching like > + * SMP, see tlb_fast_mode(). For !PREEMPT we can 'cheat' and > + * do a flush before our voluntary 'yield'. > + */ > + if (need_resched()) { > + tlb_flush_mmu(tlb); > + cond_resched(); > + } > +#endif > +} Does it matter that in the CONFIG_PREEMPT case, you no longer call cond_resched()? I guess we can just rely on the kernel full preemption to reschedule as needed. -- Catalin -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f179.google.com ([209.85.192.179]:57605 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935228Ab3E2WE4 (ORCPT ); Wed, 29 May 2013 18:04:56 -0400 Received: by mail-pd0-f179.google.com with SMTP id q11so9503981pdj.38 for ; Wed, 29 May 2013 15:04:55 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20130529175125.GJ12193@twins.programming.kicks-ass.net> References: <51A45861.1010008@gmail.com> <20130529122728.GA27176@twins.programming.kicks-ass.net> <51A5F7A7.5020604@synopsys.com> <20130529175125.GJ12193@twins.programming.kicks-ass.net> From: Catalin Marinas Date: Wed, 29 May 2013 23:04:35 +0100 Message-ID: Subject: Re: TLB and PTE coherency during munmap Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-arch-owner@vger.kernel.org List-ID: To: Peter Zijlstra Cc: Vineet Gupta , Max Filippov , KAMEZAWA Hiroyuki , "linux-arch@vger.kernel.org" , linux-mm , Ralf Baechle , Chris Zankel , Marc Gauthier , linux-xtensa@linux-xtensa.org, Hugh Dickins Message-ID: <20130529220435.30o0PpuRbN0J4QnGL6pswAxQO1TOimgbPHR2tH38Onw@z> On 29 May 2013 18:51, Peter Zijlstra wrote: > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -384,6 +384,21 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table) > > #endif /* CONFIG_HAVE_RCU_TABLE_FREE */ > > +static inline void cond_resched_tlb(struct mmu_gather *tlb) > +{ > +#ifndef CONFIG_PREEMPT > + /* > + * For full preempt kernels we must do regular batching like > + * SMP, see tlb_fast_mode(). For !PREEMPT we can 'cheat' and > + * do a flush before our voluntary 'yield'. > + */ > + if (need_resched()) { > + tlb_flush_mmu(tlb); > + cond_resched(); > + } > +#endif > +} Does it matter that in the CONFIG_PREEMPT case, you no longer call cond_resched()? I guess we can just rely on the kernel full preemption to reschedule as needed. -- Catalin