Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751615AbdGRIxu (ORCPT ); Tue, 18 Jul 2017 04:53:50 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35924 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbdGRIxq (ORCPT ); Tue, 18 Jul 2017 04:53:46 -0400 Date: Tue, 18 Jul 2017 10:53:42 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Andy Lutomirski , X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , Linus Torvalds , Andrew Morton , Mel Gorman , "linux-mm@kvack.org" , Nadav Amit , Rik van Riel , Dave Hansen , Arjan van de Ven Subject: Re: [PATCH v4 10/10] x86/mm: Try to preserve old TLB entries using PCID Message-ID: <20170718085341.nlt35dph4oukb4tc@gmail.com> References: <20170705121807.GF4941@worktop> <20170705170219.ogjnswef3ufgeklz@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170705170219.ogjnswef3ufgeklz@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1376 Lines: 41 * Peter Zijlstra wrote: > On Wed, Jul 05, 2017 at 09:04:39AM -0700, Andy Lutomirski wrote: > > On Wed, Jul 5, 2017 at 5:18 AM, Peter Zijlstra wrote: > > > On Thu, Jun 29, 2017 at 08:53:22AM -0700, Andy Lutomirski wrote: > > >> @@ -104,18 +140,20 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, > > >> > > >> /* Resume remote flushes and then read tlb_gen. */ > > >> cpumask_set_cpu(cpu, mm_cpumask(next)); > > > > > > Barriers should have a comment... what is being ordered here against > > > what? > > > > How's this comment? > > > > /* > > * Resume remote flushes and then read tlb_gen. We need to do > > * it in this order: any inc_mm_tlb_gen() caller that writes a > > * larger tlb_gen than we read here must see our cpu set in > > * mm_cpumask() so that it will know to flush us. The barrier > > * here synchronizes with inc_mm_tlb_gen(). > > */ > > Slightly confusing, you mean this, right? > > > cpumask_set_cpu(cpu, mm_cpumask()); inc_mm_tlb_gen(); > > MB MB > > next_tlb_gen = atomic64_read(&next->context.tlb_gen); flush_tlb_others(mm_cpumask()); > > > which seems to make sense. Btw., I'll wait for a v5 iteration before applying this last patch to tip:x86/mm. Thanks, Ingo