Received: by 10.213.65.68 with SMTP id h4csp936931imn; Wed, 28 Mar 2018 16:12:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx48fWeWfz0GNlCXE4i1VhND77LT09uMlqtpZaJZGPPa8PDEZzaoX+OxCzdB1XLeg06z2PsrN X-Received: by 2002:a17:902:51c3:: with SMTP id y61-v6mr5747603plh.101.1522278741632; Wed, 28 Mar 2018 16:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522278741; cv=none; d=google.com; s=arc-20160816; b=iOeTl0QJ0vnFSJW4nmeEHLBR2PT9N7l6NgagQq/Anuads6j6Ftfz1iH89fmjbGaI1w Uh+enrsqNcs8JHs3z7JnLojs4+AVIJ8A8cx7nakZKGyTpQJFMzcv95HpbNV6HnZhwXu/ 4qByuitdPzsF+VwpAlZR2dxg14Ty4QpogjZOCO6CVHTv+76+PxinRBe0DfmvOSIU205D 0J8McwyuyXTkmjwoxPtFFBrMfAfqx0ekRXXW58snFGxcBhiW5e/ZUdB2ScB/dEct+L64 Y2VecfT1Q4eKCLH5lj7B4L4W2s/v2rk/S8cTXTEbAzw/YtAAGXtMOg2JihKCDmw0ujyk 5NNQ== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=AtPrpvQHR0crsKWYf+JU87z7nASsHWFg98+EYL3phXQ=; b=CFnKIlxefue4JDwQhB6kfzueRi0otZ8bVDF4L4Q1XCaOjX86/vJ5oInCMuHhat5HqV EtrF1t6s+OzrwBiR7zRYsne3XJ7yfT5hreZSq4ZWrI1FrkkU5n40/KeK908xPM5nCQ2/ j7u3cAhSXhI+WD3xOW6FwtajONVaqW3KGV5pZGpqBAuR6Rm4Es8eE+6EfK0yoTgelxwA 93L1S+PI9vayaoq8PRpVOJm6qyL+SlTSTkuczkI4KfOo/Ixf2TCJqeudAoOuxeDoVi1v cr/1oVlLERBC5DdR0AQgKfp7QWYC/vRcnRis/FuWcrMwd6yGwOmXKDILJ+wleJbv1TjR XeUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=XGrfaqOU; 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 j66si342633pgc.566.2018.03.28.16.12.07; Wed, 28 Mar 2018 16:12:21 -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=@gmail.com header.s=20161025 header.b=XGrfaqOU; 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 S1750922AbeC1XLP (ORCPT + 99 others); Wed, 28 Mar 2018 19:11:15 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:41540 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbeC1XLN (ORCPT ); Wed, 28 Mar 2018 19:11:13 -0400 Received: by mail-ot0-f196.google.com with SMTP id i28-v6so4486756otf.8; Wed, 28 Mar 2018 16:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=AtPrpvQHR0crsKWYf+JU87z7nASsHWFg98+EYL3phXQ=; b=XGrfaqOUBu59Js0lqt1gjEzLI2Y1AeIljI9VLVXmqxt4Jr/leUXDUgW6QVyBtmeVZ5 FIsURjtgqZGBgKfV5qsBCBLbXzCTK/S+LOsVuPVgYtBxOrw8MzuvCElEt38j6Ds5Vaqy DslL796YLCNkNxAA0DXvaznWdvNbcKpf35f45cUqqIhQ1ukgtW1HkgoMdPZlB/bryzc6 vEcCdz8pmKNeLExOZKAXMRnXB2P3QT6E4IgIv9jPtHoNOel9Yh+WX/FZD/vD1Jk1w6At lIP3w/pecGkMGWF/cxLWZiRXQx1UWfPPFf5gwTLyv5a+chkhHTZWFxha6s6RSZJ99DCv fwlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=AtPrpvQHR0crsKWYf+JU87z7nASsHWFg98+EYL3phXQ=; b=uPM0WXvh4RJj/jbjgmUM8RPG/4V99WFinGeY2NJt8QKLaTFxN6jZp3x+JzuyH12tCQ oADgJ5jRIIzg+GElwF1wakh/bVqqt2zIU/J0hANG2jNTnfZZlqHRsnPpgW90V2mkZM7P E+lExIEJslmxl0qr++FTOdLNAGZbSiHv8I/mPJNr/VN8oHZQY9ASe5uFkj9O3J+yJRGL nXdlr7S2iPtrP6XeM3e1n1fqezmYhb+TTeOahNQhHEPnW57QWBSf4l+ynt7FriZEt87K 9g4I34r8y8Qly2l+RylfUAWSBWn1gP+JQ6lrIIdr0VTD9P2I3uYbdsIJlyzYhHVByiG/ 6V7w== X-Gm-Message-State: ALQs6tBtKGt5c0mNPuLyGhsN0df5mSLXfq1+D7iCr9ums+Jmzwda+KaA QBo0FTPqrHbXdjNNdX7jUsL6IK5T4SjlCiVc+VA= X-Received: by 2002:a9d:5b44:: with SMTP id e4-v6mr3221844otj.305.1522278672354; Wed, 28 Mar 2018 16:11:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:9f7:0:0:0:0:0 with HTTP; Wed, 28 Mar 2018 16:11:11 -0700 (PDT) In-Reply-To: <006501d3c6d5$2d03e500$870baf00$@net> References: <2390019.oHdSGtR3EE@aspire.rjw.lan> <2249320.0Z4q8AXauv@aspire.rjw.lan> <6462e44a-e207-6b97-22bf-ad4aed69afc2@tu-dresden.de> <4198010.6ArFqS34NK@aspire.rjw.lan> <006501d3c6d5$2d03e500$870baf00$@net> From: "Rafael J. Wysocki" Date: Thu, 29 Mar 2018 01:11:11 +0200 X-Google-Sender-Auth: dvINSnvF0KPY9L2G0q3CP4iYbpE Message-ID: Subject: Re: [RFT][PATCH v7 6/8] sched: idle: Select idle state before stopping the tick To: Doug Smythies , Thomas Ilsche Cc: Peter Zijlstra , Linux PM , Frederic Weisbecker , Thomas Gleixner , Paul McKenney , Rik van Riel , Aubrey Li , Mike Galbraith , LKML 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 Wed, Mar 28, 2018 at 10:41 PM, Doug Smythies wrote: > On 2018.03.28 08:15 Thomas Ilsche wrote: >> On 2018-03-28 12:56, Rafael J. Wysocki wrote: >>> On Wed, Mar 28, 2018 at 12:37 PM, Rafael J. Wysocki wrote: >>>> On Wed, Mar 28, 2018 at 10:38 AM, Thomas Ilsche >>>> wrote: >>>>> On 2018-03-28 10:13, Rafael J. Wysocki wrote: >>>>>> >>> >>> [cut] >>> >>>> >>>> So I do >>>> >>>> $ for cpu in 0 1 2 3; do taskset -c $cpu sh -c 'while true; do usleep >>>> 500; done' & done >>>> >>>> which is a shell kind of imitation of the above and I cannot see this >>>> issue at all. >>>> >>>> I count the number of times data->next_timer_us in menu_select() is >>>> greater than TICK_USEC and while this "workload" is running, that >>>> number is exactly 0. >>>> >>>> I'll try with a C program still. >>> >>> And with a C program I see data->next_timer_us greater than TICK_USEC >>> while it is running, so let me dig deeper. >>> >> >> I can confirm that a shell-loop behaves differently like you describe. >> Even if it's just a shell-loop calling "main{usleep(500);}" binary. > > I normally use the C program method. > The timer there returns with the need_sched() flag set. I found the problem, but addressing it will not be straightforward, which is kind of unfortunate. Namely, get_next_timer_interrupt() doesn't take high resolution timers into account if they are enabled (which I overlooked), but they obviously need to be taken into account in tick_nohz_get_sleep_length(), so calling tick_nohz_next_event() in there is not sufficient. Moreover, it needs to know the next highres timer not including the tick and that's not so easy to get. It is doable, though, AFAICS.