Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2280848ybg; Fri, 5 Jun 2020 09:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTAP7fDToDFu6YEQgIn1W0AAdKqZLP3wW6uTiFt7ZWsLpBfhTrLgXGxkRIR8tMXEHDQnqt X-Received: by 2002:a50:b022:: with SMTP id i31mr9354266edd.301.1591376048884; Fri, 05 Jun 2020 09:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591376048; cv=none; d=google.com; s=arc-20160816; b=NBR52ZBRPv/VSZ5gqQ/YAklfiQYsCS1xYL+AJ4VmHpF2wSJLmlO3deLIhoVkoeTQt6 tXi8JgMuU1woUr0+JxdThL8zek3U+87if91WB0hnMPTuJb1X/KZbCh1xlP9miiRiqY2j GSltKeH83iiHCjKD8/Uh25SWJeIPfj6lTnqc61EjpZ+sDsyxjbJVY29q3/c45RW3I4xs e7lbzcClSIIH0NPwLsOJDKD74yU6DsILn3Ps8V/rQj8mFzXmnt0txx5V6sA+yOCGuba0 cBBZozTHvse1V5XTMHdh1WAv7pTz+nwA/29G9Ngg4qYLmgY/opwCqQUJY1VZRlwsrYiL KNGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:cc:references:to:subject:ironport-sdr :ironport-sdr; bh=Y8bNrzTuItIoj/ZISwpGvgQ/pySM9B4trzoiEt6gtOI=; b=gr94nF5jin2lH8ooHIAyF9MvK3tnetigp1WOoC8MEPKWym4OAdHmLTJorBdXhfKDv9 le8QQtfue0SwQaSLobuqHx44guMY4aRgWqYV/I/Kj3QPmtxKUewEI9znLjcyJkvykcjC uWO3WI5H5WXaAaaB0YWY589Qn9ZY/fvDVtpYjzvS18I6JXU5c+IMX0oXCxgLBgzYMdos o5sigZI7EGFJE3dD7kWtCF0K9HRkpos5sHFsTeqZJqhYCV5Ju+bvUoSkVAflYJDHbNE7 c+p5I2/MXtDervXw2zNQmwDSs7vYTNVHLuJTDdfPiWIELNZzqmlpUdWzYdPSB3L7FkNy tgDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp8si4747822ejc.281.2020.06.05.09.53.46; Fri, 05 Jun 2020 09:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbgFEQvS (ORCPT + 99 others); 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