Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp674259ybp; Wed, 9 Oct 2019 02:23:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWV/OdrmyHPnoi7mPYYVefyv5X2u9iCDBRmtl3m9h2wEuW2LsXYlgAV68nKlqfTsP1ZYDz X-Received: by 2002:a50:af44:: with SMTP id g62mr2031385edd.164.1570613031323; Wed, 09 Oct 2019 02:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570613031; cv=none; d=google.com; s=arc-20160816; b=hWit1Uw9cyKtDFuu+eVNZO2RaIZxAZQdYkYf05fqNWjPvwVPawmjbM56SL37afj9RT FXSnNdP+B6dwyOoypaLZVq06Gi34UGOG+rGrgJ0lDHsl65YazK5p65+6jlAQrvs14KMo I8r34btryA2eniVZw/x/+G9zZ0FV3feCgrNeUkEtqYitW2uwhKqbTkjVtqHWtwRMmDpN cx7LsEZRlbJgkZ0JfuXfkn6I0uxh554ZwVR3ax5GHi5Vl+VyW+QBn1w5H5F8woiGnK7u lhKPWI2Oj3xD6Oa0YVczp4hkmntItQWaiEtwTCg7Fc7LKyvKMsqI9cr4alrE5GcKNy2c EC6w== 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=sCEK+LgWP7bYrUSjOBzocarMFbF2/EXLPK2/otpxFkQ=; b=NNRyJfhRS5lRTisrQO8cAea2jEBcerfL+uTmMtnsxugRmKERmDSeHnzpPKdgSpQmSE KDKE1XbkHI6IM+ffFcAdl/pEPc7XbX8JxLhSWraRSb3R0Dplt9W20IHIrysV1IzdUG95 +01eIeFRaj/TepfiobTx0qqsjQBqTTKnDuO62wMuNScWB9mJNyTA6a7y21QAnvckGTrj +keT+v8q3BNNI6sgq+PBISTLWvgENILWO8wU34GbSQLlgN/WbVqUy2NUYHXgohYmdJwm D2e7A02vvs/E/mi0vhDMVSq/Tj+vU9KqQTLWKZxj4I7vdHSPhgZaGZ+iRK4Ku3P8t1E+ 3B2g== 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 ay11si870433edb.215.2019.10.09.02.23.27; Wed, 09 Oct 2019 02:23:51 -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 S1730144AbfJIJXJ (ORCPT + 99 others); Wed, 9 Oct 2019 05:23:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50444 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726765AbfJIJXJ (ORCPT ); Wed, 9 Oct 2019 05:23:09 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x999Di4j165335 for ; Wed, 9 Oct 2019 05:23:08 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2vhbp9tm16-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Oct 2019 05:23:07 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Oct 2019 10:23:03 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) 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 10:22:58 +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 x999Mv7K59703298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Oct 2019 09:22:57 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63B854203F; Wed, 9 Oct 2019 09:22:57 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 024C342045; Wed, 9 Oct 2019 09:22:55 +0000 (GMT) Received: from localhost.localdomain (unknown [9.124.35.210]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 9 Oct 2019 09:22:54 +0000 (GMT) Subject: Re: [RFC v5 4/6] sched/fair: Tune task wake-up logic to pack small background tasks on fewer cores To: Hillf Danton Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, patrick.bellasi@matbug.net, valentin.schneider@arm.com, pavel@ucw.cz, dsmythies@telus.net, Quentin Perret , rafael.j.wysocki@intel.com, tim.c.chen@linux.intel.com, daniel.lezcano@linaro.org References: <20191007083051.4820-1-parth@linux.ibm.com> <20191008132842.6612-1-hdanton@sina.com> From: Parth Shah Date: Wed, 9 Oct 2019 14:52:54 +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: <20191008132842.6612-1-hdanton@sina.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19100909-0008-0000-0000-00000320633E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19100909-0009-0000-0000-00004A3F6726 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-09_05:,, 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-1910090087 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/8/19 6:58 PM, Hillf Danton wrote: > > On Mon, 7 Oct 2019 14:00:49 +0530 Parth Shah wrote: >> +/* >> + * Try to find a non idle core in the system based on few heuristics: >> + * - Keep track of overutilized (>80% util) and busy (>12.5% util) CPUs >> + * - If none CPUs are busy then do not select the core for task packing >> + * - If atleast one CPU is busy then do task packing unless overutilized CPUs >> + * count is < busy/2 CPU count >> + * - Always select idle CPU for task packing >> + */ >> +static int select_non_idle_core(struct task_struct *p, int prev_cpu, int target) >> +{ >> + struct cpumask *cpus = this_cpu_cpumask_var_ptr(turbo_sched_mask); >> + int iter_cpu, sibling; >> + >> + cpumask_and(cpus, cpu_online_mask, p->cpus_ptr); >> + >> + for_each_cpu_wrap(iter_cpu, cpus, prev_cpu) { >> + int idle_cpu_count = 0, non_idle_cpu_count = 0; >> + int overutil_cpu_count = 0; >> + int busy_cpu_count = 0; >> + int best_cpu = iter_cpu; >> + >> + for_each_cpu(sibling, cpu_smt_mask(iter_cpu)) { >> + __cpumask_clear_cpu(sibling, cpus); >> + if (idle_cpu(iter_cpu)) { > > Would you please elaborate the reasons that the iter cpu is checked idle > more than once for finding a busy core? > Thanks for looking at the patches. Could you please point me out where iter_cpu is checked more than once? >> + idle_cpu_count++; >> + best_cpu = iter_cpu; >> + } else { >> + non_idle_cpu_count++; >> + if (cpu_overutilized(iter_cpu)) >> + overutil_cpu_count++; >> + if (is_cpu_busy(cpu_util(iter_cpu))) >> + busy_cpu_count++; >> + } >> + } >> + >