Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4556706ybp; Mon, 7 Oct 2019 10:09:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxX8oFtcR6s5+Tr/Gqq1TyA49z1pRX79Piz4xs1wkCfc5Rl93CHXTnWV2XMvh1x5B0j206r X-Received: by 2002:a17:906:1659:: with SMTP id n25mr25135540ejd.258.1570468183387; Mon, 07 Oct 2019 10:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570468183; cv=none; d=google.com; s=arc-20160816; b=g6p/tv85cginZQHKeUjmwX3Xc9q/uqYMswOtxERy4sM7XD17OzkwDJe+Bbp88YlUVV WIo6jcjpPdbyNcPgwchBjVMbbTL+ucI+TEBgmX2mpaPKFNA360zzQ0IgOvDp9q/Ntyxf VO8sNJfRAfHMYcyZeNsOkyUIOSX9lbh93sITNWtuuqppARpDnZP+7o3FaZvrs1R9R5l5 cx01UN8uMuzBFfJjm5/2TUgdoQltlYORR/JhiUAhoYZFxAjXLuHnQ0cfEbnb4/jAq4np d2riruEsCDSaNu8EmiJuurvFfRhFoQfUKHzBJuhFvNFoQfN4w7SNunSCl1LHDXJnrglw 15ZQ== 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:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:openpgp:from:references:cc:to; bh=45mLo/aC5EDVngAJxGAGgSoHt2SHe+4e0BgqzS8RDak=; b=jnhLaZYBBUCoarJPOTPr3GGIbCDS3FEL4l9g5BKmSHf0e+5vIGUa3pLHIXDetMfFeH 2zZNsQsoFP18mRXvljHVMYzHhEEBXBkKlZHStn7w6R3nzd8NkaJU6EQZSc+gWNs4AyjH V4fNmLXbP20anFrAySD2UYrAjzdh6zV7wT7OA5twUv48QBea0JOaF463XflyktA+jXv7 0z8q9RRFtAoAq4JHA90Nh9uC67kpvoXFZNkyJu2sEaSuaRYCah6cRcHU6m5Da4hVmDXg eYStQ4S2Ur+kPfGcQ/BbtRD3HI7CV9wQBRX68EzVswD+MnHoWoyzOFpYGqaSwNNyVfhz 7fFg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si7322242ejt.143.2019.10.07.10.09.19; Mon, 07 Oct 2019 10:09:43 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbfJGRGg (ORCPT + 99 others); Mon, 7 Oct 2019 13:06:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:51863 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbfJGRGg (ORCPT ); Mon, 7 Oct 2019 13:06:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 10:06:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,268,1566889200"; d="scan'208";a="205136707" Received: from schen9-desk.jf.intel.com (HELO [10.54.74.162]) ([10.54.74.162]) by orsmga002.jf.intel.com with ESMTP; 07 Oct 2019 10:06:34 -0700 To: David Laight , 'Parth Shah' , "linux-kernel@vger.kernel.org" , "patrick.bellasi@matbug.net" , "valentin.schneider@arm.com" , "qais.yousef@arm.com" , "linux-pm@vger.kernel.org" Cc: "peterz@infradead.org" , "vincent.guittot@linaro.org" , "pavel@ucw.cz" , "mingo@redhat.com" , "morten.rasmussen@arm.com" , "pjt@google.com" , "dietmar.eggemann@arm.com" , "tj@kernel.org" , "rafael.j.wysocki@intel.com" , "daniel.lezcano@linaro.org" , "dhaval.giani@oracle.com" , "quentin.perret@arm.com" , subhra mazumdar , "ggherdovich@suse.cz" , "viresh.kumar@linaro.org" , Doug Smythies References: <2bd46086-43ff-f130-8720-8eec694eb55b@linux.ibm.com> <9645e7c625a84bfabac001fd6ef35559@AcuMS.aculab.com> From: Tim Chen Openpgp: preference=signencrypt Autocrypt: addr=tim.c.chen@linux.intel.com; prefer-encrypt=mutual; keydata= mQINBE6ONugBEAC1c8laQ2QrezbYFetwrzD0v8rOqanj5X1jkySQr3hm/rqVcDJudcfdSMv0 BNCCjt2dofFxVfRL0G8eQR4qoSgzDGDzoFva3NjTJ/34TlK9MMouLY7X5x3sXdZtrV4zhKGv 3Rt2osfARdH3QDoTUHujhQxlcPk7cwjTXe4o3aHIFbcIBUmxhqPaz3AMfdCqbhd7uWe9MAZX 7M9vk6PboyO4PgZRAs5lWRoD4ZfROtSViX49KEkO7BDClacVsODITpiaWtZVDxkYUX/D9OxG AkxmqrCxZxxZHDQos1SnS08aKD0QITm/LWQtwx1y0P4GGMXRlIAQE4rK69BDvzSaLB45ppOw AO7kw8aR3eu/sW8p016dx34bUFFTwbILJFvazpvRImdjmZGcTcvRd8QgmhNV5INyGwtfA8sn L4V13aZNZA9eWd+iuB8qZfoFiyAeHNWzLX/Moi8hB7LxFuEGnvbxYByRS83jsxjH2Bd49bTi XOsAY/YyGj6gl8KkjSbKOkj0IRy28nLisFdGBvgeQrvaLaA06VexptmrLjp1Qtyesw6zIJeP oHUImJltjPjFvyfkuIPfVIB87kukpB78bhSRA5mC365LsLRl+nrX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cFPHfzzFFn0idp7zD5SNgAXHzV PFY6UGIm86OuPZuSG31R0AU5zvcmWCeIvhxl5ZNfmZtv5h8TgmfGAgF4PSD0x/Bq4qobcfaL ugWG5FwiybPzu2H9ZLGoaRwRmCnzblJG0pRzNaC/F+0hNf63F1iSXzIlncHZ3By15bnt5QDk l50q2K/r651xphs7CGEdKi1nU0YJVbQxJQ== Subject: Re: [Discussion v2] Usecases for the per-task latency-nice attribute Message-ID: Date: Mon, 7 Oct 2019 10:06:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <9645e7c625a84bfabac001fd6ef35559@AcuMS.aculab.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/2/19 9:11 AM, David Laight wrote: > From: Parth Shah >> Sent: 30 September 2019 11:44 > ... >> 5> Separating AVX512 tasks and latency sensitive tasks on separate cores >> ( -Tim Chen ) >> =========================================================================== >> Another usecase we are considering is to segregate those workload that will >> pull down core cpu frequency (e.g. AVX512) from workload that are latency >> sensitive. There are certain tasks that need to provide a fast response >> time (latency sensitive) and they are best scheduled on cpu that has a >> lighter load and not have other tasks running on the sibling cpu that could >> pull down the cpu core frequency. >> >> Some users are running machine learning batch tasks with AVX512, and have >> observed that these tasks affect the tasks needing a fast response. They >> have to rely on manual CPU affinity to separate these tasks. With >> appropriate latency hint on task, the scheduler can be taught to separate them. > > Has this been diagnosed properly? > I can't really see how the frequency drop from AVX512 significantly affects latency. > Most tasks that require low latency probably don't do a lot of work. > It is much more likely that the latency issues happen because the AVX512 tasks > are doing very few system calls so can't be pre-empted even by a high priority task. This problem was conveyed to us by several customers. The issue is not that you are slow to preempt an AVX512 task on the same logical cpu thread, but the AVX512 tasks on the sibling CPU thread is dropping the CPU frequency and lowering the performance and response. Let's say that you make the latency sensitive task a real time task with high priority so it will immediately run on a cpu after being woken. But it will be slower if there's an AVX512 running on the sibling versus if other kind of tasks are running on sibling. This is the noisy neighbor effect. So it is better to isolate the latency sensitive tasks on cores that AVX512 tasks don't run on. Tim > This 'feature' is hinted by this: >> 2> TurboSched >> ( -Parth Shah ) >> ==================== >> TurboSched [2] tries to minimize the number of active cores in a socket by >> packing an un-important and low-utilization (named jitter) task on an >> already active core and thus refrains from waking up of a new core if >> possible. > > Consider this example of a process that requires low latency (sub 1ms would be good): > - A hardware interrupt (or timer interrupt) wakes up on thread. > - When that thread wakes it wakes up other threads that are sleeping. > - All the threads 'beaver away' for a few ms (processing RTP and other audio). > - They all sleep for the rest of a 10ms period. > > The affinities are set so each thread runs on a separate cpu, and all are SCHED_RR. > Now loop all the cpus in userspace (run: while :; do :; done) and see what happens to the latencies. > You really want the SCHED_RR threads to immediately pre-empt the running processes. > But I suspect nothing happens until a timer interrupt to the target cpu. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) >