Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752996Ab3HAB6Z (ORCPT ); Wed, 31 Jul 2013 21:58:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61991 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050Ab3HAB6Y (ORCPT ); Wed, 31 Jul 2013 21:58:24 -0400 Message-ID: <51F9C0B8.9000707@redhat.com> Date: Wed, 31 Jul 2013 21:58:16 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Linus Torvalds CC: Paul Turner , Linux Kernel Mailing List , jmario@redhat.com, Peter Anvin , dzickus@redhat.com, Ingo Molnar Subject: Re: [PATCH] sched,x86: optimize switch_mm for multi-threaded workloads References: <20130731174335.006a58f9@annuminas.surriel.com> <51F98CAB.80100@redhat.com> <51F99218.4060104@redhat.com> <51F999DE.7080200@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1610 Lines: 39 On 07/31/2013 08:41 PM, Linus Torvalds wrote: > On Wed, Jul 31, 2013 at 4:14 PM, Paul Turner wrote: >> We attached the following explanatory comment to our version of the patch: >> >> /* >> * In the common case (two user threads sharing mm >> * switching) the bit will be set; avoid doing a write >> * (via atomic test & set) unless we have to. This is >> * safe, because no other CPU ever writes to our bit >> * in the mask, and interrupts are off (so we can't >> * take a TLB IPI here.) If we don't do this, then >> * switching threads will pingpong the cpumask >> * cacheline. >> */ > > So as mentioned, the "interrupts will be off" is actually dubious. > It's true for the context switch case, but not for the activate_mm(). > > However, as Rik points out, activate_mm() is different in that we > shouldn't have any preexisting MMU state anyway. And besides, that > should never trigger the "prev == next" case. > > But it does look a bit messy, and even your comment is a bit > misleading (it might make somebody think that all of switch_mm() is > protected from interrupts) > . > Anyway, I'm perfectly ok with the patch itself, but I just wanted to > make sure people had thought about these things. Would you like me to document the things we found in the comment, and resend a patch, or is the patch good as-is? -- All rights reversed -- 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/