Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2573606ybi; Sat, 13 Jul 2019 18:20:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEvKalP3XodxT4bEbC3j2eLVWKta8OocOB34uGm3/BJDuCLnVUy9KPvdYXn7ZEFT0WU4Ci X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr20356881plt.102.1563067241513; Sat, 13 Jul 2019 18:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563067241; cv=none; d=google.com; s=arc-20160816; b=PvOFMJ3B+TWaGC22u6xJ0B1sXIBGvQeq1+Dd9dNpT64YY/Be0jr0I3pvnofmGoNxRl 1CreXfcXlbrI/qQMhMltF8goZ1lBviLYyFWahsSfwUUKvKjEZ3BnUM0vzUAjyV5L8zWW YAKg4VWXnIMmC6BEqWP07sLdsyJmfQ5Wvhj2Of6Lm6zWYsBGYgU8sr1w2JMcCaxT7RkJ NZq+nXm9UU62sBKrkKV6H4rRBVjwaGv9Z2crFZV6Kzqo/PrlrcRfM1ttBNlHV6aRR7Pj /4I16aU7iTOntWPxBI87Cd8pW18GqSbrGqv2Oq9PDYSyPbOXQSax9BIcpPTinHNjFd5t iJUg== 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:from:references:cc:to:subject:dkim-signature; bh=gnStV7SBtyBELVgdhWru5ZF/zwLQRRjtxakJR6QK8O4=; b=dKvzDdSFBVwY+DL94u/pcIx6Tu0XkPqWizk7SZwWYommD+lpElA7arG6u7uLUVUfoq qMhpz1K1C7U+qMG8DhTmLrHJdjE8kSD5ZqdYqS87WOv/27+CxBYhGBIBB8QpkVXLS9Oa WPPl8L/o4dir20ZLUVtKfgikonhzMJkYTt9vmBUQPQjNfB6qs+VwA6nKZ1Ts0zl3yMUW BmOWKs4p22qyFzLzK2syvlj4eP8a7ufrhBlBeNVo5gF9IUrEe3jL7ITmACYZzmUBjVeF m3rbAiZilPvvs3Ux0mWH4giMXs+LQELKNJalWA5XWElfRI+K3BAgsJeKwaBJ8w+qG08s TA8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=LEjRHErO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si11788712pgc.185.2019.07.13.18.20.25; Sat, 13 Jul 2019 18:20:41 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=LEjRHErO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbfGNBSK (ORCPT + 99 others); Sat, 13 Jul 2019 21:18:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:35154 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbfGNBSJ (ORCPT ); Sat, 13 Jul 2019 21:18:09 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6E1EoEl079200; Sun, 14 Jul 2019 01:16:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=gnStV7SBtyBELVgdhWru5ZF/zwLQRRjtxakJR6QK8O4=; b=LEjRHErOUwlLHTSiY35a9/RWgVlntWcQEXHjz41W6JsOj1fltQqrqIidgrzVOp4pHh+6 oJu2jP99ATK1ItUm55tSIWIDhSwIHgyzB4bxR/Zc/4n+rKDgdQuhBLFUY/r5dXvReqwO nN7pTUZnim4bbV2ABiPjxnAcdiy/GJiEAGM2Ex0a7BhIrXp0T1dhvQGKBaJbrCYfEeP0 cVsN29inpLK7+vPi/6/hm3e9V6fbHTFnga8rFqbvjw5JfWd/MlGFE0pZujhYy2RgoyYq aSCy24tFdUiGBZN8lzBaCN5NcOhfcfj3PorxoraCvWgelXEsOHh0kvu9Unsu9BOq4sz2 yQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2tq7xqhu07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Jul 2019 01:16:19 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6E1EJt4138593; Sun, 14 Jul 2019 01:16:18 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2tq4dstp55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Jul 2019 01:16:18 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x6E1GAde016937; Sun, 14 Jul 2019 01:16:10 GMT Received: from Subhras-MacBook-Pro.local (/103.87.143.145) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Jul 2019 18:16:10 -0700 Subject: Re: [PATCH v3 5/7] sched: SIS_CORE to disable idle core search To: Parth Shah , linux-kernel@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com, tglx@linutronix.de, steven.sistare@oracle.com, dhaval.giani@oracle.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, viresh.kumar@linaro.org, tim.c.chen@linux.intel.com, mgorman@techsingularity.net References: <20190627012919.4341-1-subhra.mazumdar@oracle.com> <20190627012919.4341-6-subhra.mazumdar@oracle.com> <0e0f3347-c262-2917-76d7-88dddf4e9122@linux.ibm.com> <59ab08d5-8b7c-00b9-230b-7c0b307a675f@oracle.com> <12402fea-7b87-8c4d-9485-53f973c38654@oracle.com> From: Subhra Mazumdar Message-ID: Date: Sun, 14 Jul 2019 06:46:01 +0530 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9317 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907140013 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9317 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default 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-1810050000 definitions=main-1907140014 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/4/19 6:04 PM, Parth Shah wrote: > Same experiment with hackbench and with perf analysis shows increase in L1 > cache miss rate with these patches > (Lower is better) > Baseline(%) Patch(%) > ----------------------- ------------- ----------- > Total Cache miss rate 17.01 19(-11%) > L1 icache miss rate 5.45 6.7(-22%) > > > > So is is possible for idle_cpu search to try checking target_cpu first and > then goto sliding window if not found. > Below diff works as expected in IBM POWER9 system and resolves the problem > of far wakeup upto large extent. > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index ff2e9b5c3ac5..fae035ce1162 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6161,6 +6161,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t > u64 time, cost; > s64 delta; > int cpu, limit, floor, target_tmp, nr = INT_MAX; > + struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask); > > this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); > if (!this_sd) > @@ -6198,16 +6199,22 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t > > time = local_clock(); > > - for_each_cpu_wrap(cpu, sched_domain_span(sd), target_tmp) { > + cpumask_and(cpus, sched_domain_span(sd), &p->cpus_allowed); > + for_each_cpu_wrap(cpu, cpu_smt_mask(target), target) { > + __cpumask_clear_cpu(cpu, cpus); > + if (available_idle_cpu(cpu)) > + goto idle_cpu_exit; > + } > + > + for_each_cpu_wrap(cpu, cpus, target_tmp) { > per_cpu(next_cpu, target) = cpu; > if (!--nr) > return -1; > - if (!cpumask_test_cpu(cpu, &p->cpus_allowed)) > - continue; > if (available_idle_cpu(cpu)) > break; > } > > +idle_cpu_exit: > time = local_clock() - time; > cost = this_sd->avg_scan_cost; > delta = (s64)(time - cost) / 8; > > > > Best, > Parth How about calling select_idle_smt before select_idle_cpu from select_idle_sibling? That should have the same effect.