Received: by 2002:a17:90a:b81:0:0:0:0 with SMTP id 1csp995627pjr; Fri, 30 Aug 2019 10:59:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoYxwpISHsYeoEh85wRrkidi5gqamWyqtslRlWSFl7CKVHm/YYcP4f2QXBUrxe9+JFu2qw X-Received: by 2002:a17:902:ab8e:: with SMTP id f14mr17308063plr.6.1567187954669; Fri, 30 Aug 2019 10:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567187954; cv=none; d=google.com; s=arc-20160816; b=BIdcsAbckzSlnyHHMf20oaTasyGfTWDI6tH92uIgyiP+j6BbH1KerEY14nlWaTI/S6 GxnAT2Nw8zljAPkse8Nnbj4CrKBlVJbaugHFkpu7ij0ISSFTslyP5Arr5FpEUPW9rPxv vuX1dV4ltBF557jXkisvwz8tknJGzponnWMTpJx7GVdRKngfgfyfUnw2Z9lYbWuIbH12 qumlZXCN57FwMIlyro24cTN44Ry9Gvt058zhBIIDgqbosZSGuCMvmarH8+v6nRPufcoj aVj2ZtvSL1Mlp+zsIjEV7AFVAlfcE32xJZnBnL83+3NlOxOMz5p4sB9CfD/wPKBtjqyC Dzvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=wAuaqsNTYu9PLpGsR9PztanzZXV9e3lo4XXN0aBZ7ak=; b=hTmfQlHMDMBUzC4TeT62Ov5vWsxoD3/qcF9n6S2Q2HEHoTx1YldnvQTN27V3pIexvQ dJui/PvJO6+lmIWAoJsj00/nTFa49dsDt0KatZs35v7h2KmOwuBdmYfdPb1iq833Aa+E SNoQxUk+dVbFHJY1hPspSovJAw//K9Ys5CVR7C0S/LWmOXmlx2eO6UczrRGqvDy6z13I DYN9iAyRlyQXHZCghmF7ENsSqsgbkvuOW8awEtSN45o7JYwOUE/cXlERoH9Lh76GUJjU PtSn7UOZ0Ydnc2hfc87v8BiVFio/sFkwJ+5jeNLKBHmoUhQXtoPYiBcGYRIjgTyibqIa h31g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=hRAHlA+G; 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 j1si6238994pfr.52.2019.08.30.10.58.59; Fri, 30 Aug 2019 10:59:14 -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-2019-08-05 header.b=hRAHlA+G; 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 S1727991AbfH3Rzt (ORCPT + 99 others); Fri, 30 Aug 2019 13:55:49 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34030 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbfH3Rzs (ORCPT ); Fri, 30 Aug 2019 13:55:48 -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 x7UHt6PD088735; Fri, 30 Aug 2019 17:55:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=wAuaqsNTYu9PLpGsR9PztanzZXV9e3lo4XXN0aBZ7ak=; b=hRAHlA+GNBi6Flv1rXd9eR+sCusOVFNJveXPZXWPKKNjyFckv84qXx+3FXkNl7q4qrps hQWfQsP2nUte9wgn3kpfuocRoqJ+Z1NUKjeYMjhP+JPPqz+pk/PjXYaAig/028asw6VC 8R9ujkLD2dVz5zU48Av00W3BOBgvlKDNQ2WgYz+Nk0iVMYMVP1L0yJQUDmDM4pxUr7MA SAKfj10xIxmhRnEr9iBbDzoINb6VwJUGNbEb2WV4Mqsn9/zPjU6UBxCiX7cul+4CRJV8 tooWuxsWQVqP4oAn1x3aYN7YVeZOmaaqFSt8AEMr2EVx7cIrGCD74CvbXnng+PMeB+AQ IA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2uq8fsg20y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Aug 2019 17:55:09 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7UHrrnH072175; Fri, 30 Aug 2019 17:54:35 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2upc8xrmea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Aug 2019 17:54:35 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7UHsXMU014831; Fri, 30 Aug 2019 17:54:33 GMT Received: from smazumda-Precision-T1600.us.oracle.com (/10.132.91.113) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 Aug 2019 10:54:33 -0700 From: subhra mazumdar To: 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, parth@linux.ibm.com, patrick.bellasi@arm.com Subject: [RFC PATCH 2/9] sched: add search limit as per latency-nice Date: Fri, 30 Aug 2019 10:49:37 -0700 Message-Id: <20190830174944.21741-3-subhra.mazumdar@oracle.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20190830174944.21741-1-subhra.mazumdar@oracle.com> References: <20190830174944.21741-1-subhra.mazumdar@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9365 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 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-1906280000 definitions=main-1908300174 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9365 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908300174 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Put upper and lower limit on CPU search in select_idle_cpu. The lower limit is set to amount of CPUs in a core while upper limit is derived from the latency-nice of the thread. This ensures for any architecture we will usually search beyond a core. Changing the latency-nice value by user will change the search cost making it appropriate for given workload. Signed-off-by: subhra mazumdar --- kernel/sched/fair.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b08d00c..c31082d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6188,7 +6188,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t u64 avg_cost, avg_idle; u64 time, cost; s64 delta; - int cpu, nr = INT_MAX; + int cpu, floor, nr = INT_MAX; this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); if (!this_sd) @@ -6205,11 +6205,12 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t return -1; if (sched_feat(SIS_PROP)) { - u64 span_avg = sd->span_weight * avg_idle; - if (span_avg > 4*avg_cost) - nr = div_u64(span_avg, avg_cost); - else - nr = 4; + floor = cpumask_weight(topology_sibling_cpumask(target)); + if (floor < 2) + floor = 2; + nr = (p->latency_nice * sd->span_weight) / LATENCY_NICE_MAX; + if (nr < floor) + nr = floor; } time = local_clock(); -- 2.9.3