Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4349100imm; Mon, 20 Aug 2018 14:22:47 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzn+ECNBSILHlkix1cqInaM7HO1wZ0ujviOl/q8lVZ1omDsO9L718Ie5Yxi8cznMTVPaVwp X-Received: by 2002:a63:de4c:: with SMTP id y12-v6mr44599186pgi.435.1534800167066; Mon, 20 Aug 2018 14:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534800167; cv=none; d=google.com; s=arc-20160816; b=QC+3f8Fi1EtEoB8rAoheZ0s3ojidfOfP/Hcld97zap2B1bpB66Pn9Ex42WFcMzVyN9 Zh3xFuAm7CNKcwTeCiBjO7qtlnTf46rIi7ScCcyZh6PdfuGLl/ND9KXATkcP+TgIMFe4 ou/G/tWHD4TeYNMRp1I186IzB0TjmnRnU78PKeY1Iyl/BobtshmWHF9jyEMk1kie6fyf IMj6nav/nZoR2XWRPd/opz40rlLL06SZwYV9yLEyz6Y+ygVhqQlAPgZqfy+FDhsfazdU /ebcp+/2xyS20MWMKWYIcEK9QWfTpeI/s10i4Z9JwbMUCNwVXR/naqQ5diucSve91YqF VddA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=hQiuAF/Hn9K/8uBFxuKMy+i9l/kcGbsm5FBg2xp2gAc=; b=N2OP0ZSbOJzpnFv1K9HGJRH+zwwvfNHDN7S/XTmhe7fDPoJSWLogAgFnDrjSumVt0o WCTJ8oK+9SLa9ZU+YWiR8haXU+wpqFQZiFY/JMK/X31Lo0kNV7nczILVo8YmjI+jX6Wb BA1D7bYkIJ2am9D0OUSXiRhWDOsZYYrY8NkWWkwB2Ic3vf1VQ9Ip68lgmI8J8KJV9s3b H182D0Q3dAu4axugbfesFH/ZZ2RmUSIyQaSQcsm9VjQ84AbCDRT9LIMY/iX08cxVFS75 UVWnBvdnOtfXONizAIkLY5+/8uMFMKIX5ZPlje3B5EXxSk1uz6IWuiryXllNhJIV6gyw s98g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si10164358pgl.620.2018.08.20.14.22.31; Mon, 20 Aug 2018 14:22:47 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbeHUAij (ORCPT + 99 others); Mon, 20 Aug 2018 20:38:39 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:39915 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbeHUAij (ORCPT ); Mon, 20 Aug 2018 20:38:39 -0400 Received: by mail-oi0-f68.google.com with SMTP id d189-v6so28439662oib.6; Mon, 20 Aug 2018 14:21:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hQiuAF/Hn9K/8uBFxuKMy+i9l/kcGbsm5FBg2xp2gAc=; b=MJVwM73T6KNC+ULIn7Yes3rrcBlViqVQDYWhm56XtcSPYbhOoT7mnr53RGegvYviKp RUIIKdSG2OBhIaVD/h9uh3sE4+1dOVuVByHSTObPEK9kVBlolb8WIj36UFhHW1qvNzsi MFSrYIffOSw8oTQJklQhdProfWd5DrOpASe26/eKpwBg9WlJbCbJgus6HzBElUcu1vd7 PYlDZsoDCtnjjVvO+at5u3bHCTx5eFP6CVzYDq+5q7ODqh6rYQWCeGKyxAp1iTewrl7Q sGSZ53V4/S7wOVexrImsXaZPGJuZRRwQwSeJAUxZYaw3UArT4JLeDSJrO7z/iXAXUgDG 6Thg== X-Gm-Message-State: AOUpUlFCnsNzFeMgWtpvE78Inl6SzpolR1snumx3ZT/2+I2WzNAF0GSi OVKAi5sp8k+Atnukwo2eT5U2NoV9rzFsfV0X66pI8A== X-Received: by 2002:aca:190d:: with SMTP id l13-v6mr15707022oii.216.1534800085217; Mon, 20 Aug 2018 14:21:25 -0700 (PDT) MIME-Version: 1.0 References: <2161372.IsD4PDzmmY@aspire.rjw.lan> <20180816132723.GA6010@lerouge> <10817203.8q7neLTJVD@aspire.rjw.lan> <20180817141252.GA12426@lerouge> <20180820144249.GA9770@lerouge> In-Reply-To: <20180820144249.GA9770@lerouge> From: "Rafael J. Wysocki" Date: Mon, 20 Aug 2018 23:21:13 +0200 Message-ID: Subject: Re: [PATCH] sched: idle: Avoid retaining the tick when it has been stopped To: Frederic Weisbecker Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Peter Zijlstra , Linux PM , Linux Kernel Mailing List , Ingo Molnar , Leo Yan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 20, 2018 at 4:42 PM Frederic Weisbecker wrote: > > On Sat, Aug 18, 2018 at 11:57:00PM +0200, Rafael J. Wysocki wrote: > > On Fri, Aug 17, 2018 at 4:12 PM Frederic Weisbecker wrote: [cut] > > > > Now, in general, there are two reasons for the idle governor (whatever > > it is) to select an idle state with a target residency below the tick > > period length. The first reason is when the governor knows that the > > closest timer event is going to occur in this time frame, but in that > > case (as stated above), it is not necessary to worry about the tick, > > because the other timer will trigger soon enough anyway. The second > > reason is when the governor predicts a wakeup which is not by a timer > > in this time frame and it is quite arguable what the governor should > > do then. IMO it at least is not unreasonable to throw the prediction > > away and still go for the closest timer event in that case (which is > > the current approach). > > Then in this case, when you say you throw away that prediction, does it > mean you select an idle state that only takes the next timer event into > consideration? Yes, it does. > So for example we predict a wake up event TICK_NSEC ahead but the next > timer event is a few seconds, you're going to select an idle state > according to that "few seconds" ahead next event, right? (which in > practice is likely to be deep I guess). > > I guess so but, just want to be sure I understand you correctly. More precisely, if the original predicted idle duration is less than TICK_USEC and the tick has been stopped, the governor takes the time till the next timer event instead of the predicted value (so effectively the predicted value is discarded). If the original predicted idle duration is TICK_USEC or more, the tick would have been stopped anyway (had it not been stopped already), so it may as well be used for idle state selection in the stopped tick case. Cheers, Rafael