Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3202351ybd; Mon, 24 Jun 2019 21:38:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqygR9dkRntYsX5yq1BA77Z0cjpPT6fqPgxhiaTZexVSxEBb2r5yGq7D57ku9ElmZOGn823N X-Received: by 2002:a17:902:7297:: with SMTP id d23mr139327175pll.254.1561437532303; Mon, 24 Jun 2019 21:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561437532; cv=none; d=google.com; s=arc-20160816; b=Oxuzt3f5eR9TBpl3qXPHSul2zYhUf0VqFNuE8hiAYqRpuvM5vJgoLqVxjKGkcL6Sn0 9eaeYqTkqAIlmpw1gbUpY75YM0gc6HtAMpR4wzJaK/JVaqa9rY/j6IkGMqVONBOJfB4L M6O9DJdFGSCruIZSuf3gBBM8kq4vyasDQTDIl5BwA1sGtoOvY9/Sw63zykOnCrCeyuOV P/oapHxRjPXhe2uKci7TH9Y51wni98WuNTLqCKT+jMuwt0XzyBDeJyKVphoqsTK3EKSk hlXLhQQKo9q3vE30Xu7QiQuQpqlbrP89kl4I52s4BTuihWvU9NxuNxtflpc/ts9PIAdT 2yGQ== 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=8fgCsJ8yrIK0Q5g3KW3iiuV7nxWJWf8+zh0Bjitx6zU=; b=nBy1SdB7vEcp84Q5ahCbwR+hPOBaGVb9w5b5nVlyOyY1kV60D2u8irMeYxPsCA+8Cs UpTmVtmu7DsKD4wnw7m9TfGWAj6wVJPhNJlqPx3V7rSoCpE4X4ur0mnJDRd6xBicFc+u D5hF/Ym3tKrzzpasGvyFFRZ4gS44WpFaJld8IagDXSis9yRwgTg0oIJPC678DE8BTrhc wVHhdYKu+kwdB8jva5+60NlDkxH+TCCr/gHylhbXmR+Z2lwVE2jvqADsNm+Wse0OUlM1 ICJf59Uyulo5SX8vWdifPq4RtX1sdSF8UGs4TV+4+KLfhu+HYXsRyloEEfGLLwbANovs etpg== 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 l67si13222621plb.370.2019.06.24.21.38.37; Mon, 24 Jun 2019 21:38:52 -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 S1727082AbfFYEhr (ORCPT + 99 others); Tue, 25 Jun 2019 00:37:47 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51146 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbfFYEhm (ORCPT ); Tue, 25 Jun 2019 00:37:42 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5P4X7kH141945 for ; Tue, 25 Jun 2019 00:37:41 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tbadfcc7a-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 25 Jun 2019 00:37:40 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Jun 2019 05:37:38 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 25 Jun 2019 05:37:35 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5P4bYjo33751518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2019 04:37:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA47511C05B; Tue, 25 Jun 2019 04:37:34 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9969511C050; Tue, 25 Jun 2019 04:37:33 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.87]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 25 Jun 2019 04:37:33 +0000 (GMT) From: Parth Shah To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, dietmar.eggemann@arm.com, patrick.bellasi@arm.com Subject: [RFCv3 4/8] sched/fair: Define core capacity to limit task packing Date: Tue, 25 Jun 2019 10:07:22 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190625043726.21490-1-parth@linux.ibm.com> References: <20190625043726.21490-1-parth@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19062504-4275-0000-0000-00000345534D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19062504-4276-0000-0000-000038558DD5 Message-Id: <20190625043726.21490-5-parth@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-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-1810050000 definitions=main-1906250036 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch defines 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. This patch provides 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 e8c5eb339e35..ff3f88d788d8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5929,6 +5929,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