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,URIBL_BLOCKED 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 8F2B3C4363A for ; Mon, 5 Oct 2020 11:19:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AAF620774 for ; Mon, 5 Oct 2020 11:19:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="V66/orP3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725982AbgJELTj (ORCPT ); Mon, 5 Oct 2020 07:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgJELTi (ORCPT ); Mon, 5 Oct 2020 07:19:38 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30ED0C0613CE; Mon, 5 Oct 2020 04:19:38 -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=Ra1YPs5Ur9GmtKp6lL+9W2Oo4CFvG8xsosvNRMWmnLY=; b=V66/orP3bwMW/YEzkQN47EHpD0 ZHYBKXwFpZjN1JhOy9tkZOghvamu5T3Xn0IC3/1aT+Ov6tncf/sfxBH43pTa8WPtZ9mE6bv4Dpkrs 2ll0hJz5kXjlhB29PBgIL9r0MHsTl5moUvqWlCgs69PnX/c3lK2Mq1pXoB8WMUrmlouauK1PHtFSb 9ZIBHXKXEvl82+Tyy6wPJeNLYf1gPAFbY331j42cE1K5aZaFBJegF5nzybQs3ZqTdT5M35NKUSAzJ uncFb5gRUMbtuwwcwEfLS/EI+pEaVfSJPsPTJWUBds9Kb1Z6FKddw+lVuhGZ6XPsNhf44tduhmXoh NiQh4hmw==; 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 1kPOWZ-0006Pv-K0; Mon, 05 Oct 2020 11:19:23 +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 C8C17300B22; Mon, 5 Oct 2020 13:19:20 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AE5B020C19001; Mon, 5 Oct 2020 13:19:20 +0200 (CEST) Date: Mon, 5 Oct 2020 13:19:20 +0200 From: Peter Zijlstra To: Xi Wang Cc: Paul Turner , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Josh Don , LKML , linux-fsdevel@vger.kernel.org, Stephane Eranian , Arnaldo Carvalho de Melo Subject: Re: [PATCH] sched: watchdog: Touch kernel watchdog in sched code Message-ID: <20201005111920.GO2611@hirez.programming.kicks-ass.net> References: <20200304213941.112303-1-xii@google.com> <20200305075742.GR2596@hirez.programming.kicks-ass.net> <20200306084039.GC12561@hirez.programming.kicks-ass.net> 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 Fri, Mar 06, 2020 at 02:34:20PM -0800, Xi Wang wrote: > On Fri, Mar 6, 2020 at 12:40 AM Peter Zijlstra wrote: > > > > On Thu, Mar 05, 2020 at 02:11:49PM -0800, Paul Turner wrote: > > > The goal is to improve jitter since we're constantly periodically > > > preempting other classes to run the watchdog. Even on a single CPU > > > this is measurable as jitter in the us range. But, what increases the > > > motivation is this disruption has been recently magnified by CPU > > > "gifts" which require evicting the whole core when one of the siblings > > > schedules one of these watchdog threads. > > > > > > The majority outcome being asserted here is that we could actually > > > exercise pick_next_task if required -- there are other potential > > > things this will catch, but they are much more braindead generally > > > speaking (e.g. a bug in pick_next_task itself). > > > > I still utterly hate what the patch does though; there is no way I'll > > have watchdog code hook in the scheduler like this. That's just asking > > for trouble. > > > > Why isn't it sufficient to sample the existing context switch counters > > from the watchdog? And why can't we fix that? > > We could go to pick next and repick the same task. There won't be a > context switch but we still want to hold the watchdog. I assume such a > counter also needs to be per cpu and inside the rq lock. There doesn't > seem to be an existing one that fits this purpose. Sorry, your reply got lost, but I just ran into something that reminded me of this. There's sched_count. That's currently schedstat, but if you can find a spot in a hot cacheline (from schedule()'s perspective) then it should be cheap to incremenent unconditionally. If only someone were to write a useful cacheline perf tool (and no that c2c trainwreck doesn't count).