Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp652596ybp; Wed, 9 Oct 2019 02:00:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTHRhBgRfvNInyF5UMZPDO8FeHAUrfsWikcRaE3EAZIdTCKatUGv8LordKpIwNgyI6UAxb X-Received: by 2002:a17:906:3049:: with SMTP id d9mr1704950ejd.288.1570611632947; Wed, 09 Oct 2019 02:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570611632; cv=none; d=google.com; s=arc-20160816; b=f5BKX5bM/AsERgyTpMUORrr3KFjZV/usB/Cn5Qeo/5oesUQJ28QP92sDeD5lxjzz6D sjppeiThUViq5E1I8/wOUxJU0xMjfL8OLhFAfrqdPPl6C+THptAqhJ79XUAdApUWvJ8n 9qK16qDOhNGi5oieKWvWFwONNkRoZSLVs8lNkx+/LJ233aPehoMdhHOYE/H4I7lMX2M5 WdQcty5wq1uqmGJgNo2+wPI/Tc9ovfFUtFLU4s4SoTmYc0mL27Ji/VM7dGQ3/XnYwQpr 1q9OSgKi7+nP4ZKsisJAuHsrwSd8kNlCM4sdS9nAVyKiHBF7R32GnzjRrCLzHI+4HWar 7STQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=iO/bDfU3uy0muRO4n5lCvK78mQFtnFQCMfCFv/f9XIA=; b=ORd6lIjyi5EVWPeQLGSK/KpXexD5d4DNi0lkS09JoiMD5BrQFjGnQcWxts7Y7hs1jj Ne/wAT14xq7eJYoWpMWjv9pElCWViVbVgyHYhofzRSlcwPJCjMVOu6ZQx39LK1UGMZ3t pFl1HBUeqZQ23gNCcCu3O45eKoapjWywXF/aqp/g9pn810WAlKVhxIGgelJEDTa/kme/ 0+yeE7cUHpVZB2lNV3ZKpm8ucke8cF7E3jxsN1kvVLD132uH8MfXs4mMwi9S4A+cARUi XaCYIEmiX8mlJ4uzhLZgQf0NBVzHXB3ZItyAMzlZrSucQFBZHz3jkshAS+J4ATboXr8X Adyw== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10si747946ejc.337.2019.10.09.02.00.09; Wed, 09 Oct 2019 02:00:32 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729918AbfJII5k (ORCPT + 99 others); Wed, 9 Oct 2019 04:57:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:9402 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725903AbfJII5k (ORCPT ); Wed, 9 Oct 2019 04:57:40 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x998vawI091660 for ; Wed, 9 Oct 2019 04:57:37 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2vha4cmpr1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Oct 2019 04:57:37 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Oct 2019 09:57:23 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 9 Oct 2019 09:57:18 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x998vH2L26214522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Oct 2019 08:57:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9B5842041; Wed, 9 Oct 2019 08:57:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93A954204B; Wed, 9 Oct 2019 08:57:15 +0000 (GMT) Received: from localhost.localdomain (unknown [9.124.35.210]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 9 Oct 2019 08:57:15 +0000 (GMT) Subject: Re: [RFC v5 4/6] sched/fair: Tune task wake-up logic to pack small background tasks on fewer cores To: Dietmar Eggemann , Vincent Guittot Cc: linux-kernel , "open list:THERMAL" , Peter Zijlstra , Ingo Molnar , Patrick Bellasi , Valentin Schneider , Pavel Machek , Doug Smythies , Quentin Perret , "Rafael J. Wysocki" , Tim Chen , Daniel Lezcano References: <20191007083051.4820-1-parth@linux.ibm.com> <20191007083051.4820-5-parth@linux.ibm.com> <80bb34ec-6358-f4dc-d20d-cde6c9d7e197@linux.ibm.com> From: Parth Shah Date: Wed, 9 Oct 2019 14:27:14 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19100908-0020-0000-0000-000003776260 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19100908-0021-0000-0000-000021CD67E2 Message-Id: <86dc25e4-9f19-627f-9581-d74608b7f20c@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-09_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910090085 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/8/19 10:22 PM, Dietmar Eggemann wrote: > [- Quentin Perret ] > [+ Quentin Perret ] > > See commit c193a3ffc282 ("mailmap: Update email address for Quentin Perret") > noted. thanks for notifying me. > On 07/10/2019 18:53, Parth Shah wrote: >> >> >> On 10/7/19 5:49 PM, Vincent Guittot wrote: >>> On Mon, 7 Oct 2019 at 10:31, Parth Shah wrote: >>>> >>>> The algorithm finds the first non idle core in the system and tries to >>>> place a task in the idle CPU in the chosen core. To maintain >>>> cache hotness, work of finding non idle core starts from the prev_cpu, >>>> which also reduces task ping-pong behaviour inside of the core. >>>> >>>> Define a new method to select_non_idle_core which keep tracks of the idle >>>> and non-idle CPUs in the core and based on the heuristics determines if the >>>> core is sufficiently busy to place the incoming backgroung task. The >>>> heuristic further defines the non-idle CPU into either busy (>12.5% util) >>>> CPU and overutilized (>80% util) CPU. >>>> - The core containing more idle CPUs and no busy CPUs is not selected for >>>> packing >>>> - The core if contains more than 1 overutilized CPUs are exempted from >>>> task packing >>>> - Pack if there is atleast one busy CPU and overutilized CPUs count is <2 >>>> >>>> Value of 12.5% utilization for busy CPU gives sufficient heuristics for CPU >>>> doing enough work an > > [...] > >>>> @@ -6483,7 +6572,11 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f >>>> } else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */ >>>> /* Fast path */ >>>> >>>> - new_cpu = select_idle_sibling(p, prev_cpu, new_cpu); >>>> + if (is_turbosched_enabled() && unlikely(is_background_task(p))) >>>> + new_cpu = turbosched_select_non_idle_core(p, prev_cpu, >>>> + new_cpu); >>> >>> Could you add turbosched_select_non_idle_core() similarly to >>> find_energy_efficient_cpu() ? >>> Add it at the beg select_task_rq_fair() >>> Return immediately with theCPU if you have found one >>> Or let the normal path select a CPU if the >>> turbosched_select_non_idle_core() has not been able to find a suitable >>> CPU for packing >>> >> >> of course. I can do that. >> I was just not aware about the effect of wake_affine and so was waiting for >> such comments to be sure of. Thanks for this. >> Maybe I can add just below the sched_energy_present(){...} construct giving >> precedence to EAS? I'm asking this because I remember Patrick telling me to >> leverage task packing for android as well? > > I have a hard time imaging that Turbosched will be used in Android next > to EAS in the foreseeable future. > > First of all, EAS provides task packing already on Performance Domain > (PD) level (a.k.a. as cluster on traditional 2-cluster Arm/Arm64 > big.LITTLE or DynamIQ (with Phantom domains (out of tree solution)). > This is where we can safe energy without harming latency. > > See the tests results under '2.1 Energy test case' in > > https://lore.kernel.org/r/20181203095628.11858-1-quentin.perret@arm.com > > There are 10 to 50 small (classified solely by task utilization) tasks > per test case and EAS shows an effect on energy consumption by packing > them onto the PD (cluster) of the small CPUs. > > And second, the CPU supported topology is different to the one you're > testing on. > cool. I was just keeping in mind the following quote " defining a generic spread-vs-pack wakeup policy which is something Android also could benefit from " (https://lkml.org/lkml/2019/6/28/628) BTW, IIUC that does task consolidation only on single CPU unless rd->overload is set, right? > [...] >