Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761066AbaJDALk (ORCPT ); Fri, 3 Oct 2014 20:11:40 -0400 Received: from mail-vc0-f175.google.com ([209.85.220.175]:62632 "EHLO mail-vc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759533AbaJDALY (ORCPT ); Fri, 3 Oct 2014 20:11:24 -0400 MIME-Version: 1.0 In-Reply-To: References: <20140921184153.GA23727@redhat.com> <542E2B05.5080607@oracle.com> <20141003232631.GA3439@redhat.com> Date: Fri, 3 Oct 2014 17:11:23 -0700 X-Google-Sender-Auth: wBtwuC25EscdShCEv_e0Z-rtAbQ Message-ID: Subject: Re: [tip:x86/asm] x86: Speed up ___preempt_schedule*() by using THUNK helpers From: Linus Torvalds To: Oleg Nesterov Cc: Sasha Levin , Frederic Weisbecker , Ingo Molnar , Peter Anvin , Linux Kernel Mailing List , Peter Zijlstra , Andy Lutomirski , Denys Vlasenko , Thomas Gleixner , Chuck Ebbert Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 3, 2014 at 5:01 PM, Linus Torvalds wrote: > > The real fix would appear to be to use > "preempt_enable_no_resched_notrace()", which your patch did, but > without the loop. Actually, the real fix would be to not be stupid, and just make the code do something like > if (likely(!preemptible())) > return; > > __preempt_count_add(PREEMPT_ACTIVE); > prev_ctx = exception_enter(); > > __schedule(); > > exception_exit(prev_ctx); > __preempt_count_sub(PREEMPT_ACTIVE); and *not* enable preemption around the scheduling at all. The whole enable and then re-disable seems entirely broken, and comes from the code using "preempt_schedule()" which doesn't work while preemption is disabled. So don't do that then. No? Linus -- 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/