Received: by 10.192.165.148 with SMTP id m20csp5337244imm; Wed, 9 May 2018 03:27:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoixeD7XikPf+ElmO7atAPm1XMGK1rdrhf6g8LrHfUAVmxxVjVqZvjTmpQAPHbKxPhSczIw X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr1812805plp.333.1525861660896; Wed, 09 May 2018 03:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525861660; cv=none; d=google.com; s=arc-20160816; b=Rveh67yy5JQ2m8Ne/KSOttPMMckmsbf4sSk9VGYxwUyxcF8dkuKJClmnuGD03iTapi WHRfcBdvKeyyLaW+60LCAHtut3T5FLVo13DA2aNoupwFDQDtrtFd2RpiIHNFOzhjsxhf C4JjgIFIdvhUXPmYmsP28CD4fMNiR1ge9gCegNpkXFAmaVhOgZsjX/Lb1hyK2wdl4fnQ Z9fslBd4ue6IatUJdvHGOVybpK1HokPdhYhfomK46xCTfQhumkrw2QqW4MQmqAFMwaym P+uJrRXm2WxSCgaJAvhNeADtoj8YI/3ReIEBa2N8sMW4/RrlTlRj2bbTlqPiWWwnx+hG s+mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hiy5mCwn+X3GBy2fvC0qy7poT0adi7TtKudZmw9F1bI=; b=WUElV9h6UnvBJByBfc4vljNxyBiGkJmKyB+hxrDhaS1OXd94hJY8pkHrLcV5Z0mNRM YByRlSBppyWOhTFyToKK+AzIgnXwL8THU2s8tbZ53Y6yLX2dS+fR7mnStxCi9yKbL9cv dXJYy+7QRUdURa3JiJKWPOC/JPV9rlDWEdKDpHEfr+Ta1CetnduxyEyk5k70oOO8i9LN GXgUnfxG8yrRsJPvoADiioL2Tfq6eWkaGtPqvXP577n/FVKxb1vLTYKhCVj1DXEZs8CW 4eKAKYxRsvfJFM66v9VemOlTubITyC82cg0oi8FtYzuJGoftvlRG1T0LaYyc1/N6f/a2 qoHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=GYYBMCMe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s16-v6si9367037pgo.89.2018.05.09.03.27.26; Wed, 09 May 2018 03:27:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=GYYBMCMe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934503AbeEIK1D (ORCPT + 99 others); Wed, 9 May 2018 06:27:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51942 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933715AbeEIK1B (ORCPT ); Wed, 9 May 2018 06:27:01 -0400 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hiy5mCwn+X3GBy2fvC0qy7poT0adi7TtKudZmw9F1bI=; b=GYYBMCMeKF0n3FCnG9PngPBiM LZ4nHTdUB1Yn7zOfIu19KcQxBOxxXJ7tmUCykLES0ScNlja/YUZGEP3RbvBXIaJOpGOWesOlZz8UM aPsLAVl0pzOlZRt6Sl+3hblsKFBllDG+28cjhxnspVOuslIRm6593afpH9UYADShlzZImTjaFj6Mg hM+JZHIQgRCRBsBUacYt6OgaZgBphxbbembRj8xRGOAtY73EMvof6ugFTmN6Fu6B+IcfvWpB0ZPwU TekgVuz2f1g1lw1rc4Hr9fs68SPpPBwWJ2bYkA8YbQYpkuc4P+S2aXGMglE4WjUk1P7EQ261SW0Na V0/9DV9DQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGMJ5-0007Ft-Nu; Wed, 09 May 2018 10:26:47 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6AF332029FA13; Wed, 9 May 2018 12:26:46 +0200 (CEST) Date: Wed, 9 May 2018 12:26:46 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org, Ingo Molnar , Andrew Morton , Tejun Heo , Balbir Singh , Mike Galbraith , Oliver Yang , Shakeel Butt , xxx xxx , Taras Kondratiuk , Daniel Walker , Vinayak Menon , Ruslan Ruslichenko , kernel-team@fb.com Subject: Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180509102646.GO12217@hirez.programming.kicks-ass.net> References: <20180507210135.1823-1-hannes@cmpxchg.org> <20180507210135.1823-7-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180507210135.1823-7-hannes@cmpxchg.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 05:01:34PM -0400, Johannes Weiner wrote: > +static void psi_clock(struct work_struct *work) > +{ > + dwork = to_delayed_work(work); > + group = container_of(dwork, struct psi_group, clock_work); > + > + > + /* Keep the clock ticking only when there is action */ > + if (nonidle_total) > + schedule_delayed_work(dwork, MY_LOAD_FREQ); > +} Note that this doesn't generate a stable frequency for the callback. The (nondeterministic) time spend doing the actual work is added to each period, this gives an unconditional downward bias to the frequency, but also makes it very unstable. You want explicit management of timer->expires, and add MY_LOAD_FREQ (which is a misnomer) to it and not reset it based on jiffies.