Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp151354pxf; Wed, 17 Mar 2021 01:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfJ1anw//RtxVOIsrPRGamMuDc/sfNp0/v/zYadpHTzLP2O+5saTa8xGLgRYOrxjkHg69y X-Received: by 2002:a17:906:c1ca:: with SMTP id bw10mr34204935ejb.510.1615970014222; Wed, 17 Mar 2021 01:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615970014; cv=none; d=google.com; s=arc-20160816; b=BS/QcSUgUctrpNW7TLfJq2x/dSgearmvwzQcLirwoCqBvJogKjlBQpq+bbKKIYV3Q0 CfG3ZSTzcOj07Hjv+ML5sAg+bN4CVMFhP3RAKZ8SE5pN4diMJOIZ+/I0p1/hSNbZrkjV 5zSTUc09j5glE/d9hqkFOWHunsiXSB/61yNOc7lxvRomeTELhHc/B/fqYKh4E5RIrhxX c3w4yI2P2XLXR26X29W5GRG09cPz98ygb7yOEv/XJGu/aCw0F48jaqZHGy/nmu0Iltaq lUHtad6ceUU3TdXpT6egRNRkKsrHwLhkJBcqBMiUwcSx5x25taHF38eNsKaww5oidQMn s19g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=cHZTOPy8YpHReL/nMjpSJvrdN7LdFEoSUmRWRaZIzBY=; b=ThE78Yu+5OCR7/2u1WSHfOUFMgraixcB9+bA6wbuJFNh8JKcc1ZzgsYpuQOl78zcKP 9tjELiLkSK2LzB0WQRHxjOBaXN5RDX6AgQOBMECY6I/x4uoT7Japktcyv2OQsqENqQd9 Xigz4o3JvwQoyasNx4zZLBcdjshbo3qsJJypyeXfjAbXf3ToJzq0YgJv92z1czI1ZreM 3LbebUA5v38te9zqmtz13wNNBkAbWRu2H94QapAFuydtAXAyIMQDYVdfIGKGmrdpMZ2l UK9dVhjoseoToIlYu0UfotmE4RFqytIVSsjFDeaQu7kJJ7Oa6dAMEbMwBTQiNJk9OOcT oWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ipURJRhm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si15412784edi.290.2021.03.17.01.33.12; Wed, 17 Mar 2021 01:33:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ipURJRhm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbhCQIbx (ORCPT + 99 others); Wed, 17 Mar 2021 04:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbhCQIbp (ORCPT ); Wed, 17 Mar 2021 04:31:45 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79DDC06174A; Wed, 17 Mar 2021 01:31:44 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id j7so889624wrd.1; Wed, 17 Mar 2021 01:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cHZTOPy8YpHReL/nMjpSJvrdN7LdFEoSUmRWRaZIzBY=; b=ipURJRhme0LjS0xWeMuiAfAsTYp60CwUWHlam21Yc1mHDQp3XlFyUdsZcevsZdQpGD JzpaZ+SAi2WBe1Qd1UV/y/P+LRs7O+q7t7eKYdQVS68po/G6bKGK1FJCML874VV+aHQM V1dFw75iuMCx1rQ7dZj2dDNFXFVBxo/E8cqHoLU9Qdvu7LzPhUUn/uiiJfm4KBuPBrDm 9TcGoiQqldvN3uzuBOD4wWUZ7U2In25adEDuMWEvATGP/KfNa+uWl+B8/s1Zi/Mp97WV nAUSJwz1HRNnxrny6TjEvH85L17I3mx1OSaVlPzCFpS/8ZD8rZw39thBYOWm13lAXPwl X/iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=cHZTOPy8YpHReL/nMjpSJvrdN7LdFEoSUmRWRaZIzBY=; b=orguoMhe9EWW7R2LpHVinsOGuohoe5J9YqqbD4BDOgE6gDhvAzKfvOFsTXCAl135dO NZfVvbiJGB3x08S6ysKdokHs/Sjuxon4tIbytUDLU4RCRNnd5yXrMpNSLleyzxO4Rns9 JGH8Zsayw7BIxdpcTM92lZPrSLeuHePnqaxxgICLh7khBV9oYkY8ldKRl8CgjHhJuNnV U7UlAQIcYI+sA3gPkaNf1DsLILl7PeFMeF/MlULgqgrsYrN5RMma0aVxxTHnbViRBEHz QRM5VSoql1ilXpDdf0QYe8hmHslYOHpOydHmj4s6xb3RIQaQJMEOw1/P7eQXeFOpcgZt V3qw== X-Gm-Message-State: AOAM532aheszyL+nHw5uLNeVb/1upHtztYf+y6ckas0BgbsoqiqwK1U8 nYCL/fISySn8wOFow/3XTYY= X-Received: by 2002:a5d:4ac4:: with SMTP id y4mr3127563wrs.86.1615969903780; Wed, 17 Mar 2021 01:31:43 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id v3sm1705710wmj.25.2021.03.17.01.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 01:31:43 -0700 (PDT) Sender: Ingo Molnar Date: Wed, 17 Mar 2021 09:31:41 +0100 From: Ingo Molnar To: Josh Don Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Luis Chamberlain , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Rientjes , Oleg Rombakh , Paul Turner Subject: Re: [PATCH] sched: Warn on long periods of pending need_resched Message-ID: <20210317083141.GB3881262@gmail.com> References: <20210317045949.1584952-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210317045949.1584952-1-joshdon@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Josh Don wrote: > +static inline u64 resched_latency_check(struct rq *rq) > +{ > + int latency_warn_ms = READ_ONCE(sysctl_resched_latency_warn_ms); > + bool warn_only_once = (latency_warn_ms == RESCHED_DEFAULT_WARN_LATENCY_MS); > + u64 need_resched_latency, now = rq_clock(rq); > + static bool warned_once; > + > + if (warn_only_once && warned_once) > + return 0; > + > + if (!need_resched() || latency_warn_ms < 2) > + return 0; > + > + /* Disable this warning for the first few mins after boot */ > + if (now < RESCHED_BOOT_QUIET_SEC * NSEC_PER_SEC) > + return 0; > + > + if (!rq->last_seen_need_resched_ns) { > + rq->last_seen_need_resched_ns = now; > + rq->ticks_without_resched = 0; > + return 0; > + } > + > + rq->ticks_without_resched++; So AFAICS this will only really do something useful on full-nohz kernels with sufficiently long scheduler ticks, right? On other kernels the scheduler tick interrupt, when it returns to user-space, will trigger a reschedule if it sees a need_resched. Thanks, Ingo