Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3633528ybi; Fri, 5 Jul 2019 10:51:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYd6EUO21aX9jz+h2UruIGIDFZX1Z+fx49XHuMq8SZsUdDLKTlJOAfqDq3fs2GwCIhSfof X-Received: by 2002:a63:6b0a:: with SMTP id g10mr6669843pgc.295.1562349093858; Fri, 05 Jul 2019 10:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562349093; cv=none; d=google.com; s=arc-20160816; b=I6OPBjR9YqVB4Ir03nPwcyq5y77684VgXkXoXRPlqF5KxgY42V98uAUC/yKfIqvbtT jzYSTCoQ6P/KrwYJ/huK3Lez4/7/kZD7Zp4sJRvs+lH/bjJW7DEhTith8+c3VWxiUoj6 9NVIJaqEUcMSP1PIr7+vK9TmE3/pDsZJYCWPRwAd2j2rt1ps2WV0L84WeQxtUx4kldMB qMWA+XA5WLPusomieDkjK0ijdh6z8lkn1h0HwwgPOOqjOu1OkD5nQ40FO2i3v11+VPHQ e8VSV20GY5KzdEF16+HnyZSeMCPqPHB/8O5YG3976wBtc8PtpLEUlQEVv2sDjYCTcYuV h5+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to:dkim-signature; bh=lT49eBtmE30QT+N0LpenHBVtCzyNDyCGeA0xIY9l0tk=; b=JUCa4GCBX51MPtJi+DaFdSwL4YqGlp/CZak0nJKLGGg4UVQOIoxlgZ8rvCOPG7OIvA 9DFl2V9bGllKI7B/4Z72Rr6ZA4QLsGsLBrhHKUw/VoIIr+ai5Ndug/cv3LzUrKYVp7Xb rduGGLogXLUGbDYZViVUTFZX/kPGOEce/eXe3FX628TIFz3kWZLQReynLtIDrOYRGw0j cS/gijp72SxidE4w2jQv1rrf9E/I8UeFDtoJ+N5O6w56BRltM95Prbv2j8A9IFfkMLmz Sk0qXqcdSfh6okDuhLXdOoylQ6WWwzlkz5yu7iDPHlf4k+ifDZ3uvHmQVNjioVan+lbp a0Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TH1cOfk7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si8709680pgv.566.2019.07.05.10.51.18; Fri, 05 Jul 2019 10:51:33 -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=pass header.i=@gmail.com header.s=20161025 header.b=TH1cOfk7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728101AbfGERWj (ORCPT + 99 others); Fri, 5 Jul 2019 13:22:39 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35123 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbfGERWj (ORCPT ); Fri, 5 Jul 2019 13:22:39 -0400 Received: by mail-lj1-f193.google.com with SMTP id x25so3192186ljh.2; Fri, 05 Jul 2019 10:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=lT49eBtmE30QT+N0LpenHBVtCzyNDyCGeA0xIY9l0tk=; b=TH1cOfk7h7XdTuH/U8jqosVLTVKqq3nVANlSKgBsXnDb19Bj07zotkkXWGko5UjXte +GAE7pWx4g3csHgt9q7+ze2QC4u2QUhVH03dxA2PWhq4Rm2I17tWoAlW9dUZNxBAp3Dg aciXgHWRHP/FT+SZK1BZpT7vPLoH1r+ySJ5K8tobYqWGnu0Ezcel/H4+fnu7nQyKdQt8 sxtTWcpGYMG9SsumQf4ZdsVRZepSjvTPzuRR9hP5BPiJm6WvhexuJB3Eyp1UgGFCmAQf pDkT6cxe0YjzUkrktUep0A2WIkhwZkLLG9bSEQdUYg9noOhDcwJvGiMJ17KoMKs4xcAz 9yAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=lT49eBtmE30QT+N0LpenHBVtCzyNDyCGeA0xIY9l0tk=; b=gSOZ4SKZVwm2EmZ5bbnVbEQZP3xDmsMYhcYankbqZbDpN/X22BAczuxEpDfc6Ro8Lw Cl73yl5Zwl4V1k5v/F8S0jFx/1dWos5qO3z+ttma6/rjOsCVByZNYIo6X+fxUlLFDeNU q7CU6B83erITBdnYAo/eMYy3zYIvwfa0vOH7+ZbzGuY5l7NFtG7G9AKb/YL7zrbiQ0/1 BkzfV1PSipwkx7CRuQ4rAqhQOiPmBzQNVuBFNMlEOjQGCvfpDnyYX3Cry+4nxMYUb45h tz1uhNAD7UFKeFWLwjaFdZ2UKu1IgJJK7RSSreEUYjuxiOeRhbuL+iDY7Y6JAY19yjrA Cb2g== X-Gm-Message-State: APjAAAVez9SiKX/+Z/DJM5+c7TOUBW9CJq5Ewzul/UiOQiQKVet90uk4 kKeOYLF3HRponhfRtaDjUzZQ9trQ X-Received: by 2002:a2e:25a:: with SMTP id 87mr2830557ljc.183.1562347356709; Fri, 05 Jul 2019 10:22:36 -0700 (PDT) Received: from [84.217.171.228] (c-74afd954.51034-0-757473696b74.bbcust.telenor.se. [84.217.171.228]) by smtp.gmail.com with ESMTPSA id 27sm1852775ljw.97.2019.07.05.10.22.35 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jul 2019 10:22:36 -0700 (PDT) To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org From: Thomas Lindroth Subject: The tick is active on idle adaptive-tick CPUs when /dev/cpu_dma_latency is used Message-ID: <79b247b3-e056-610e-9a07-e685dfdaa6c9@gmail.com> Date: Fri, 5 Jul 2019 19:22:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On recent kernels the tick remains active on idle adaptive-tick CPUs when a small value is written to /dev/cpu_dma_latency to restrict the highest C-state. Before the idle loop redesign in 4.17 idle CPUs had the tick disabled even when C-state were restricted. Is this change intentional or a regression? I use an x86_64 system built with CONFIG_NO_HZ_FULL that I recently upgraded to the 4.19 series from the 4.14 series. I noticed that adaptive-tick CPUs (nohz_full=1-7) still fire timer interrupts about 1000 times/s (CONFIG_HZ_1000=y) even when they are mostly idle. Some debugging showed that this only happens when a program is writing to /dev/cpu_dma_latency to restrict C-states. The old 4.14 kernel only have around 10 timer interrupts per second on idle adaptive-tick CPU even when C-states are restricted that way. I would expect an adaptive-tick CPU to turn off the tick when it has 0 or 1 processes to run and enable the tick for >2 processes. Kernels after 4.17 instead have the tick on when 0 or >2 processes are running and the tick off in the 1 process case. Since the tick is off when a single process is running that workload isn't directly harmed by the change but if the CPU use hyperthreading the constant wakeups on an idle HT sibling will reduce performance on the other sibling. They way I look for timer interrupts is by comparing the LOC line in /proc/interrupts or using the hrtimer_expire_entry tracepoint when function=tick_sched_timer. Both methods seem to give the same results. I can reproduce the problem using an i7-4790K CPU with /sys/devices/system/cpu/cpuidle/current_driver:intel_idle. I can also reproduce the problem on an old core2duo laptop with current_driver:acpi_idle but I can't reproduce the problem in a virtual machine where current_driver:none. I also can't reproduce the problem if C-states are restricted using the intel_idle.max_cstate=1 kernel argument instead of /dev/cpu_dma_latency. The commit that introduced the change is 554c8aa8ec "sched: idle: Select idle state before stopping the tick" in v4.17 and the problem exists at least up to kernel 5.1 using the menu cpuidle governor.