Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1738417pxk; Sun, 13 Sep 2020 14:28:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjjWNC9Kw96Ov9ZMblUXZUMWiIAogGWLAsF15T/+XewEhN/vKcJQovnLxDpntjf5i1ItQW X-Received: by 2002:a50:8709:: with SMTP id i9mr14628859edb.141.1600032518745; Sun, 13 Sep 2020 14:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600032518; cv=none; d=google.com; s=arc-20160816; b=XpkK5pUwWXsxD+2tDfPdTIGTG7Dgx2I+E2uLxhUazmQJxvxQJ4o7UIFGN+ZdByQKwB p1Gnl4yBejkJ+eL98XSmRs3bHO5nfy4LD1R8jWy5Zbfk144VatLHKFN5okYx5+Cg63rT fjfoN8qrwhG9Vs4niscZLV/2ANpgCCDs79xT03uSXAh3SUmSXY8mhEUO6Qs6l//sRRh7 aPUuAtBsms8k0t79V9BCC0dNJig+yb4uVV1KUD0tS629Qg+RsAsWvr+nvLP1wlH4MYa1 T4uhBk9WUwB0AmLs+BXOxbOS0g7twBqN3mTARW7XAoxGMcFxC+I0duzQIsMFIZTYcZr5 GHTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:to:dkim-signature:dkim-signature:from; bh=Mn+lpAZkUaJqWbxEFRYMZxDOSxcAn/m1i3GxkUhpnHQ=; b=ju4TtlYrdTNZhXFGHE7bM8FdH22BkSNI5F7KQFZHjV/xPhiLFf52C/rdTAS5dhoAe+ GKcjZRxSqgAoCVpBYN8R29gPEi+bLEaI1Z2/kO4YMW52eDybOUJAdv+bRV0Uc5rvwbMJ WVwuR532FEcLjv+EdTbWyxlI9/1mTcC7+o9b7E/j6t23foqqx73c7Pc4pzwT/TH+EYN2 Gyj+Tcy551TiWLjCv3NrWwwzUaf41m4ZyW6pjqftQrqHzuClGolvaroL0RnUgxkVdFJc FlYb3fQDWdIFpLHqdoTyzS1CvqAD06JEGdn5bi4NT+hi1KuVfZMR5/dMJT+8BhJ7piIt hDHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OuFtZfWQ; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=hIXeJozM; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si6257600edi.48.2020.09.13.14.28.16; Sun, 13 Sep 2020 14:28:38 -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=@linutronix.de header.s=2020 header.b=OuFtZfWQ; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=hIXeJozM; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725956AbgIMV1U (ORCPT + 99 others); Sun, 13 Sep 2020 17:27:20 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:58160 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgIMV1Q (ORCPT ); Sun, 13 Sep 2020 17:27:16 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600032435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Mn+lpAZkUaJqWbxEFRYMZxDOSxcAn/m1i3GxkUhpnHQ=; b=OuFtZfWQCUT2Rb/MT91ILoTnI1YcdasEECYWRc2hmzvOT5434UM6yNuX1+bzEk/tChUjTi vDvBIro4cG9auCpdIQDse2+qekzEleaDcjdC7YTj1DWrRK/cZY21CO+55dCcsbYU/lxLnI UWBMd2hKD0NnAHeXBlqJm3nm0m0XVIAtzXhIqDG3Xi7ELu6mQ4lNpW3/gKgMKRcK8KbG1z l3COZr4cdSPZB9wMfpmvDn4aE8Ok3VUQQzozpamDBQyXKHxmlf8xaejy6j5ENsKQ19Cvma A9XSAaEKpOVpFdO1aoPYdKppjv46Z/XDqJyk7wHKCnEeQBQQjiIEH1jSJTIOUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600032435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Mn+lpAZkUaJqWbxEFRYMZxDOSxcAn/m1i3GxkUhpnHQ=; b=hIXeJozMIkN6E6UsA/OlcA2rnMJ3aYOhXPmnfigXRA9FIJiA9aiJUwcWKNoiff79q7ic8V /+MZYYFL3Q+4RjAQ== To: Tom Hromatka , tom.hromatka@oracle.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, fweisbec@gmail.com, mingo@kernel.org, adobriyan@gmail.com Subject: Re: [RESEND PATCH 1/2] tick-sched: Do not clear the iowait and idle times In-Reply-To: <20200909144122.77210-2-tom.hromatka@oracle.com> References: <20200909144122.77210-1-tom.hromatka@oracle.com> <20200909144122.77210-2-tom.hromatka@oracle.com> Date: Sun, 13 Sep 2020 23:27:14 +0200 Message-ID: <87ft7lpdu5.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tom, On Wed, Sep 09 2020 at 08:41, Tom Hromatka wrote: > A customer reported that when a cpu goes offline and then comes back > online, the overall cpu idle and iowait data in /proc/stat decreases. > This is wreaking havoc with their cpu usage calculations. for a changelog it's pretty irrelevant whether a customer reported something or not. Fact is that this happens and you fail to explain WHY it happens, i.e. because the values are cleared when the CPU goes down and therefore the accounting starts over from 0 when the CPU comes online again. Describing this is much more useful than showing random numbers before and after. > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -1375,13 +1375,22 @@ void tick_setup_sched_timer(void) > void tick_cancel_sched_timer(int cpu) > { > struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); > + ktime_t idle_sleeptime, iowait_sleeptime; > > # ifdef CONFIG_HIGH_RES_TIMERS > if (ts->sched_timer.base) > hrtimer_cancel(&ts->sched_timer); > # endif > > + /* save off and restore the idle_sleeptime and the iowait_sleeptime > + * to avoid discontinuities and ensure that they are monotonically > + * increasing > + */ /* * Please use sane multiline comment style and not the above * abomination. */ Also please explain what this 'monotonically increasing' thing is about. Without consulting the changelog it's hard to figure out what that means. Comments are valuable but only when they make actually sense on their own. Something like the below perhaps? /* * Preserve idle and iowait sleep times accross a CPU offline/online * sequence as they are accumulative. */ Hmm? > + idle_sleeptime = ts->idle_sleeptime; > + iowait_sleeptime = ts->iowait_sleeptime; > memset(ts, 0, sizeof(*ts)); > + ts->idle_sleeptime = idle_sleeptime; > + ts->iowait_sleeptime = iowait_sleeptime; > } Thanks, tglx