Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2942691imu; Wed, 7 Nov 2018 02:10:33 -0800 (PST) X-Google-Smtp-Source: AJdET5f8yVB5yCPrhBP3DE7HME8G+vBW8G/MgnylLj80hP4APnYnIJDGdBYaAfQ8++Ygor7uPQWB X-Received: by 2002:a62:fb14:: with SMTP id x20-v6mr1218023pfm.71.1541585433805; Wed, 07 Nov 2018 02:10:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541585433; cv=none; d=google.com; s=arc-20160816; b=yKKZ8gxta4yIUViFBTCq9lODQUsgl9IitSupgNCUYhAkC4URytyLekYqDKtvMRLtmX dI2/cjv9f/PL3pKPScDyj6inTHBugPb6Tn2LBmf6oq1jmlVdE/aNIKv482lhvCIy+pN6 eMgn+6QUFxU1FZUV0hI12d5NSvtOEE8cfExW/hpHNEhSQCq3sxjkus//7p1ZAOqInGny //NFaRAXV3hEjjsNUdisE2bu8YzGkoNk0uBDoTx/aD/UwwhKOEaYx/P4v7dTVlrZrGWK u6/Bd8GTeglBvwMyNZKSwzIBlZCX5Anux+bNt91Sb4mPBuy+BLWHyMKwzFcQYEzD7RhE jl4Q== 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; bh=hlUwO1VZrUM9HCiTW+9Tathdzf6Whp66v77agIKu3lc=; b=HMLxflmcCk0lt7CHL4VCgvlyxqD9auTK8cC8ydSMq/c1LJ2TcrNJB23aKxhHxpJ0XI Cz0e7VwRC9hamCeW/1eK6bTgLC6Hybyxr8FuAoMsDcJwNKIGtZwOYZHZesdDeL2DFIqF bxPETnaY1+7gDNlJZk0H2OAy1Y0htYEhiaKwPnmKKB/jABZbi2aF0/ofgP2d0yrhM81X pz8dPS2UlxCphzQjtjuai+FvhpYIlPCpY8gDTWS0IvkCv/TFe7KE2NfV7D5XG5da9FEG 2mpZSvA0HQ+8elTWCMbCVjvL1qRw424EyoVbW39ia0e0csEI2jZ0VNkMj8Dd9WY3S6uP yFDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jm6qsNfO; 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 u72si141895pgc.360.2018.11.07.02.10.18; Wed, 07 Nov 2018 02:10:33 -0800 (PST) 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=jm6qsNfO; 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 S1730659AbeKGTjC (ORCPT + 99 others); Wed, 7 Nov 2018 14:39:02 -0500 Received: from merlin.infradead.org ([205.233.59.134]:55698 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeKGTjC (ORCPT ); Wed, 7 Nov 2018 14:39:02 -0500 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=hlUwO1VZrUM9HCiTW+9Tathdzf6Whp66v77agIKu3lc=; b=jm6qsNfO3GJc5OFNn68Ln8/vB ieAVrieDSAYLlg5QltOqBqd1FIIfcKqIG/9nAoVxq16BpnoK1QeoOl6/lyPnedr87dIdDwMoqYiJP RYPErdtU22Ob8Gp+7AHsY5ZkzNagm5cSriaH0vUTSv5VDh/0480wd6fxd1aPrAHuMyN89SMQ3S28E 1hr0hXMLm5mOHAMzfgShiqNuecKMq117L/bZlB7bzQotzdCL/As5bLtM5jj19Tt66X12qpnoP2JQe 65joCwiJjvpSio/21tCUWoGmP24oW2Vh9BecDVsFa69Bx1N764Lt4CsVjgB8kqZE7jF/kGrW98mH8 1G4olkd8Q==; 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 1gKKls-0003yB-Eg; Wed, 07 Nov 2018 10:09:12 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9888E20284F9D; Wed, 7 Nov 2018 11:09:08 +0100 (CET) Date: Wed, 7 Nov 2018 11:09:08 +0100 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , Giovanni Gherdovich , Doug Smythies , Srinivas Pandruvada , Linux Kernel Mailing List , Frederic Weisbecker , Mel Gorman , Daniel Lezcano , Nicolas Pitre Subject: [RFC][PATCH] irq/timings: Ignore predictions in the past Message-ID: <20181107100908.GJ9781@hirez.programming.kicks-ass.net> References: <1556808.yKVbhZSazi@aspire.rjw.lan> <20181106170442.GC9781@hirez.programming.kicks-ass.net> <20181106195127.GD9781@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 12:39:31AM +0100, Rafael J. Wysocki wrote: > In general, however, I need to be convinced that interrupts that > didn't wake up the CPU from idle are relevant for next wakeup > prediction. So you're worried about the case where we're 100% busy and generating IO interrupts (disk, network, etc..) and then go idle and those interrupts stop happening, but we'll base a prediction off of them? Any predictor will have some of those trancients, but note that we'll only actually train the irq timing thing when here is idle time. If we're 100% busy, we'll never actually consume the data. Also, I think the below delta (on top of my earlier patch) would make sense; as I don't see how the current code makes sense there. --- a/kernel/irq/timings.c +++ b/kernel/irq/timings.c @@ -306,22 +306,17 @@ u64 irq_timings_next_event(u64 now) continue; if (irqs->next_evt <= now) { - irq = i; - next_evt = now; - /* - * This interrupt mustn't use in the future - * until new events occur and update the - * statistics. + * If the last prediction was in the past, mark the IRQ + * as invalid until a next interrupt updates the + * prediction. */ irqs->valid = 0; - break; + continue; } - if (irqs->next_evt < next_evt) { - irq = i; + if (irqs->next_evt < next_evt) next_evt = irqs->next_evt; - } } return next_evt;