Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11060878ybi; Thu, 25 Jul 2019 09:16:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHlr1icajwAT8Jx+ISN9NT/1QqL+AWuMApkAJnZJqWVpU3OOMvGE8E44gS+oRq6IDIMa25 X-Received: by 2002:a17:90b:f0f:: with SMTP id br15mr94942243pjb.101.1564071419880; Thu, 25 Jul 2019 09:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564071419; cv=none; d=google.com; s=arc-20160816; b=XN22A3ZD1x2nAcOGClnVdkutwbTNwZwspmEkZxQ44431L5B4E0i3ZeTmKV3JPSxCZd wfmFODeRS1pubchmTd0NI6DB7h4BSlZPSjBma2tR5ks1AAn13rUlVcZV7TYoet6YtpIU nJ77smHQ2b7ljv99FskUdgNex4h1WqxYclGcjOQCq2VtKNM3Ti3eMl2lpMBoeaPHUMyv cExQvXNLFbkSU8ZU4JF/0zUBIZ1xgmAZYrEyY8xi5cOERXtOVB2C3rsZALXGRSAiNqWL 9lSt/4OHn0InL9tHVeM8rQtkir11cgGhuO3uHglXwgdY7RY1cjiRtGeCsscim9NCtRjt Vtew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=t78Z/rp6rT/yd0QFCbzJoI7VxxrZYzHtvWDLoCeHdps=; b=eiC5x1FF+e9+SsM9crgAOpiJJMziD6rF9NZJ6ACNwXp/h6tINe4EWHFKFxVqe4+3US 8M/kEVBAx+w01lRARAhXn/E068pLJ5dVUXp7c2YT9LYPFMo7pTXuQbU4car3w0YXCZRP hYMdW5JyvqxiDEPADJEVWqwKvi8ChHVcKZJ1AfZ7OkAclPD8VkCkTXyQmFCHlf44Z+9M VhOGzi+gumUZjPjhOgPVmqbU53xjBIhYY6vRI3y5z0RkBvGvPkpxU5uhJ8078/RD9zK9 DgSMJCwBNPyuZ56X3capzs0zRXWBnuM2d11dG43pah461+0HdrNNyN1yVo+GSrMwWo16 VQPw== 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 gn22si17864945plb.422.2019.07.25.09.16.45; Thu, 25 Jul 2019 09:16:59 -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 S1729624AbfGYHJT (ORCPT + 99 others); Thu, 25 Jul 2019 03:09:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37164 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729584AbfGYHJP (ORCPT ); Thu, 25 Jul 2019 03:09:15 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6P76cwl057019 for ; Thu, 25 Jul 2019 03:09:14 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ty77c981w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Jul 2019 03:09:14 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Jul 2019 08:09:11 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 25 Jul 2019 08:09:08 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6P797BT57475280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Jul 2019 07:09:07 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AC104C058; Thu, 25 Jul 2019 07:09:07 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8D444C04A; Thu, 25 Jul 2019 07:09:05 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.169]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Jul 2019 07:09:05 +0000 (GMT) From: Parth Shah To: peterz@infradead.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, patrick.bellasi@arm.com, dietmar.eggemann@arm.com, daniel.lezcano@linaro.org, subhra.mazumdar@oracle.com Subject: [RFC v4 4/8] sched/fair: Define core capacity to limit task packing Date: Thu, 25 Jul 2019 12:38:53 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190725070857.6639-1-parth@linux.ibm.com> References: <20190725070857.6639-1-parth@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19072507-0012-0000-0000-00000335FA97 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19072507-0013-0000-0000-0000216F910E Message-Id: <20190725070857.6639-5-parth@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-25_03:,, 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-1906280000 definitions=main-1907250085 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Define a method name arch_scale_core_capacity which should return the capacity of the core. This method will be used in the future patches to determine if the spare capacity is left in the core to pack jitter tasks. For some architectures, core capacity does not increase much with the number of threads (or CPUs) in the core. For such cases, architecture specific calculations needs to be done to find core capacity. In addition to this, provide a default implementation for the scaling core capacity. ToDo: As per Peter's comments, if we are getting rid of SMT capacity then we need to find a workaround for limiting task packing. I'm working around that trying to find a solution for the same but would like to get community response first to have better view. Signed-off-by: Parth Shah --- kernel/sched/fair.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b798fe7ff7cd..793e1172afc7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5964,6 +5964,25 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t return cpu; } +#ifdef CONFIG_SCHED_SMT + +#ifndef arch_scale_core_capacity +static inline unsigned long arch_scale_core_capacity(int first_thread, + unsigned long smt_cap) +{ + /* Default capacity of core is sum of cap of all the threads */ + unsigned long ret = 0; + int sibling; + + for_each_cpu(sibling, cpu_smt_mask(first_thread)) + ret += cpu_rq(sibling)->cpu_capacity; + + return ret; +} +#endif + +#endif + /* * Try and locate an idle core/thread in the LLC cache domain. */ -- 2.17.1