From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbcFITqA (ORCPT ); Thu, 9 Jun 2016 15:46:00 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33280 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbcFITp7 convert rfc822-to-8bit (ORCPT ); Thu, 9 Jun 2016 15:45:59 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [RFC 05/13] x86/mm: Add barriers and document switch_mm-vs-flush synchronization From: Nadav Amit In-Reply-To: Date: Thu, 9 Jun 2016 12:45:55 -0700 Cc: Andy Lutomirski , X86 ML , LKML , Borislav Petkov , Brian Gerst , Dave Hansen , Oleg Nesterov , "linux-mm@kvack.org" Content-Transfer-Encoding: 8BIT Message-Id: References: <95a853538da28c64dfc877c60549ec79ed7a5d69.1452294700.git.luto@kernel.org> <8D80C93B-3DD6-469B-90D6-FBC71B917EAD@gmail.com> To: Andy Lutomirski X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andy Lutomirski wrote: > On Fri, Jun 3, 2016 at 10:42 AM, Nadav Amit wrote: >> Following this patch, if (current->active_mm != mm), flush_tlb_page() still >> doesn’t call smp_mb() before checking mm_cpumask(mm). >> >> In contrast, flush_tlb_mm_range() does call smp_mb(). >> >> Is there a reason for this discrepancy? > > Not that I can remember. Is the remote flush case likely to be racy? You replied separately on another email that included a patch to fix this case. It turns out smp_mb is not needed on flush_tlb_page, since the PTE is always updated using an atomic operation. Yet, a compiler barrier is still needed, so I added smp_mb__after_atomic instead. Nadav