From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D90C9C4363A for ; Thu, 29 Oct 2020 17:43:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C36420720 for ; Thu, 29 Oct 2020 17:43:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="2+MdtFb9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbgJ2Rnu (ORCPT ); Thu, 29 Oct 2020 13:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbgJ2RnW (ORCPT ); Thu, 29 Oct 2020 13:43:22 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C975EC0613CF for ; Thu, 29 Oct 2020 10:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XJcCXXH6uTkPu39GG3ZWtoFwOzJiDkN83u9UnA4WVP8=; b=2+MdtFb9Wb8uHJzjSnoFSeYIZI QG4g5h7XCOjQmwRyF7IUFg5rg9cXAwa+qRpEI2sSijeiARTYSs0lOGqhaAWEzFm/vIiA3gMt4rVJu 7fDogNyraeeKccmWlTbdDAAQMA8Gv4SjPbnEkNcSyPVQOtR7mYW2/nG7MIDQnQxjPjPj/tej4A2u6 Ta9vnbTMdnEfTOuZFBNCX2oBIVkzEPwQ2R2qmGU746xezrvXOZXLragCsLBOaAEdli+pAuS8wnshD 4XP/UredyZVoOYNg4eW2CUwtBAGyDF7ihIWTDZb8axHLxFYv0P2c3dFZkTHwnnHVAPapvOeVjMtTF o/UvqwmQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYBx2-00029Z-FN; Thu, 29 Oct 2020 17:43:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C665F3006D0; Thu, 29 Oct 2020 18:43:02 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ADF7D20315047; Thu, 29 Oct 2020 18:43:02 +0100 (CET) Date: Thu, 29 Oct 2020 18:43:02 +0100 From: Peter Zijlstra To: Valentin Schneider Cc: tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, qais.yousef@arm.com, swood@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vincent.donnefort@arm.com, tj@kernel.org, ouwen210@hotmail.com Subject: Re: [PATCH v4 17/19] sched: Add migrate_disable() tracepoints Message-ID: <20201029174302.GV2628@hirez.programming.kicks-ass.net> References: <20201023101158.088940906@infradead.org> <20201023102347.697960969@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 04:27:26PM +0000, Valentin Schneider wrote: > > On 23/10/20 11:12, Peter Zijlstra wrote: > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -1732,6 +1732,8 @@ void migrate_disable(void) > > return; > > } > > > > + trace_sched_migrate_disable_tp(p); > > + > > preempt_disable(); > > this_rq()->nr_pinned++; > > p->migration_disabled = 1; > > @@ -1764,6 +1766,8 @@ void migrate_enable(void) > > p->migration_disabled = 0; > > this_rq()->nr_pinned--; > > preempt_enable(); > > + > > + trace_sched_migrate_enable_tp(p); > > Don't you want those directly after the ->migration_disabled write? > esp. for migrate_enable(), if that preempt_enable() leads to a context > switch then the disable->enable deltas won't reflect the kernel view. > > That delta may indeed include the time it took to run the stopper and > fix the task's affinity on migrate_enable(), but it could include all > sorts of other higher-priority tasks. I can put them in the preempt_disable() section I suppose, but these tracers should be looking at task_sched_runtime(), not walltime, and then the preemption doesn't matter. Also, a distinct lack of actual users atm.. :/