From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFAB5C433E0 for ; Fri, 5 Jun 2020 16:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A48FA207D3 for ; Fri, 5 Jun 2020 16:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbgFEQvS (ORCPT ); Fri, 5 Jun 2020 12:51:18 -0400 Received: from mga02.intel.com ([134.134.136.20]:33158 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbgFEQvR (ORCPT ); Fri, 5 Jun 2020 12:51:17 -0400 IronPort-SDR: VYTyUCeDZWDyKYS185id1RtOV0Ef1Z5wMyZiRzMtdUJKOOuSk0W11rjPOK2HexK6mX2CvI6RTI l9bJZLW5ZCHQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2020 09:51:16 -0700 IronPort-SDR: 7Arn7IAbvIVYlIlpzd7oXzQ9tQZ2H13N8ezxBepmWVr3of8JU7PwRIaupEp7p+9SDDyua7+/dC 4PXxKndlm/kA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,477,1583222400"; d="scan'208";a="313248012" Received: from rjwysock-mobl1.ger.corp.intel.com (HELO [10.249.143.24]) ([10.249.143.24]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jun 2020 09:51:14 -0700 Subject: Re: schedutil issue with serial workloads To: Alexander Monakov References: Cc: linux-kernel@vger.kernel.org, Linux PM , Peter Zijlstra , Giovanni Gherdovich , qperret@google.com, juri.lelli@redhat.com, Valentin Schneider , Vincent Guittot , Doug Smythies From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: Date: Fri, 5 Jun 2020 18:51:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/2020 11:29 PM, Alexander Monakov wrote: > Hello, Hi, Let's make more people see your report. +Peter, Giovanni, Quentin, Juri, Valentin, Vincent, Doug, and linux-pm. > this is a question/bugreport about behavior of schedutil on serial workloads > such as rsync, or './configure', or 'make install'. These workloads are > such that there's no single task that takes a substantial portion of CPU > time, but at any moment there's at least one runnable task, and overall > the workload is compute-bound. To run the workload efficiently, cpufreq > governor should select a high frequency. > > Assume the system is idle except for the workload in question. > > Sadly, schedutil will select the lowest frequency, unless the workload is > confined to one core with taskset (in which case it will select the > highest frequency, correctly though somewhat paradoxically). That's because the CPU utilization generated by the workload on all CPUs is small. Confining it to one CPU causes the utilization of this one to grow and so schedutil selects a higher frequency for it. > This sounds like it should be a known problem, but I couldn't find any > mention of it in the documentation. Well, what would you expect to happen instead of what you see? > I was able to replicate the effect with a pair of 'ping-pong' programs > that get a token, burn some cycles to simulate work, and pass the token. > Thus, each program has 50% CPU utilization. To repeat my test: > > gcc -O2 pingpong.c -o pingpong > mkfifo ping > mkfifo pong > taskset -c 0 ./pingpong 1000000 < ping > pong & > taskset -c 1 ./pingpong 1000000 < pong > ping & > echo > ping > > #include > #include > int main(int argc, char *argv[]) > { > unsigned i, n; > sscanf(argv[1], "%u", &n); > for (;;) { > char c; > read(0, &c, 1); > for (i = n; i; i--) > asm("" :: "r"(i)); > write(1, &c, 1); > } > } > > Alexander