Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756930AbaJCV5t (ORCPT ); Fri, 3 Oct 2014 17:57:49 -0400 Received: from mail-la0-f42.google.com ([209.85.215.42]:60971 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755390AbaJCV5S (ORCPT ); Fri, 3 Oct 2014 17:57:18 -0400 MIME-Version: 1.0 In-Reply-To: <20141003214124.GA31614@redhat.com> References: <20140921184153.GA23727@redhat.com> <542E2B05.5080607@oracle.com> <20141003083954.10a13a24@as> <20141003214124.GA31614@redhat.com> From: Andy Lutomirski Date: Fri, 3 Oct 2014 14:56:56 -0700 Message-ID: Subject: Re: [tip:x86/asm] x86: Speed up ___preempt_schedule*() by using THUNK helpers To: Oleg Nesterov Cc: Chuck Ebbert , Sasha Levin , Ingo Molnar , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , Linus Torvalds , Peter Zijlstra , Denys Vlasenko , Thomas Gleixner 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 2:41 PM, Oleg Nesterov wrote: > On 10/03, Chuck Ebbert wrote: >> >> > [ 921.917752] ? ___preempt_schedule_context (arch/x86/lib/thunk_64.S:44) >> > [ 921.917752] ? preempt_schedule_context (kernel/context_tracking.c:145) >> > [ 921.917752] ? ___preempt_schedule_context (arch/x86/lib/thunk_64.S:44) >> > [ 921.917752] ? preempt_schedule_context (kernel/context_tracking.c:145) >> > [ 921.917752] ? ___preempt_schedule_context (arch/x86/lib/thunk_64.S:44) >> > [ 921.917752] ? preempt_schedule_context (kernel/context_tracking.c:145) >> > [ 921.917752] ? ___preempt_schedule_context (arch/x86/lib/thunk_64.S:44) >> > [ 921.917752] ? preempt_schedule_context (kernel/context_tracking.c:145) >> > [ 921.917752] ? ___preempt_schedule_context (arch/x86/lib/thunk_64.S:44) >> > [ 921.917752] ? preempt_schedule_context (kernel/context_tracking.c:145) >> >> >> >> I *think* this is because RBP isn't being saved across task switch >> anymore? >> >> Without CONFIG_FRAME_POINTERS that night not be a problem... > > Could you please spell? > > I don't even understand "RBP isn't being saved", SAVE_CONTEXT/RESTORE_CONTEXT > do push/pop %rbp? > Is this thing missing a flags or cc clobber: # define __preempt_schedule() asm ("call ___preempt_schedule") Also, I'm at a loss as to wtf all this code is doing. There's preempt_schedule, which appears to be a normal C function. There's ___preempt_schedule, which is written in assembly and calls preempt_schedule. Then there's __preempt_schedule, which is an inline assembler function that calls ___preempt_schedule. Is this all just to make the call sequence for preempt_schedule shorter? --Andy > Thanks, > > Oleg. > -- Andy Lutomirski AMA Capital Management, LLC -- 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/