Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp602126yba; Wed, 15 May 2019 06:56:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7NakjGk5BA5Si8btShEqiJU6NCB8gtOQp++ezMr1505EdMDhvaHfhbFB0S6edgGcdcFYL X-Received: by 2002:a63:6848:: with SMTP id d69mr45097179pgc.0.1557928562890; Wed, 15 May 2019 06:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557928562; cv=none; d=google.com; s=arc-20160816; b=riOi00NtwT8S0BEj2OI/BHr00olROy4bOzwS4WbvC/+9kGI7uXAk0nIQqIN8o6PAw7 QHwBjJWsX3dAAZxO86I9NgR6/8NJQ6JvvyFy0UYI3obMynTnWWhQ/CxKZm4BERTPvT9z ceGZMMe+S3gwTfR8UdEyIuf0ECJzn+X8Ja24he0NSDU03usJxUzGe5RIW4wwHSmLnn70 qKsvGcsIgCVSSekv66dNJlJy+o4ywRuJwXZvbldxIo3IrdOqX/EkMhLChHsjoj0ju2Mw gtA2fSJ0WwlBB/UrieIyYHDGdr5fO46iRNwPLwi6xccO5dm8YzB2SOT0aB/cBjJJPDic vfzA== 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=vjShHdobI1nTnHn+doxayCqqgC8vYVCoTQSlqQ+Tm8I=; b=R5jznv8R018jScKxFh3shPrfMWcpkaZ9Bx7i4I7yhk/TzYKXG47AhelcZQtolMxgny hFd7XQoey4c3oUsWDi7CHlnlDBiW8y0MFHGzNQjDnW5uVOM7EJR96FhRQauG7OuBIvNY hMFtHDznXlDNztH9QHqe/ZcxQzV07RLEHNeH0nrL0BYbUH+iZz5vuUK8VkcF2Lr4i4I9 KnFTrhq9t/3B58Z6cmozMni9qriVu/XdJ6CX3dq4QKaRDWgWIWvIyh1PYSTJ+iFKB/+J iZw7kuRekv+ta6ibJzMw4RV7/11bTXZsnhBfbxqlC4O/VLj4qf7nRdifkk1UrpuJVpi9 uQjw== 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 b22si1024634plz.417.2019.05.15.06.55.48; Wed, 15 May 2019 06:56:02 -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 S1727861AbfEONxu (ORCPT + 99 others); Wed, 15 May 2019 09:53:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51422 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbfEONxt (ORCPT ); Wed, 15 May 2019 09:53:49 -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 x4FDrAsM079809 for ; Wed, 15 May 2019 09:53:47 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sgk1ybwmh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 May 2019 09:53:46 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 May 2019 14:53:40 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 15 May 2019 14:53:38 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4FDrb6851642486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 May 2019 13:53:37 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF54252050; Wed, 15 May 2019 13:53:36 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.102.18.182]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 18FF85204E; Wed, 15 May 2019 13:53: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, dsmythies@telus.net Subject: [RFCv2 1/6] sched/core: Add manual jitter classification from cgroup interface Date: Wed, 15 May 2019 19:23:17 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190515135322.19393-1-parth@linux.ibm.com> References: <20190515135322.19393-1-parth@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19051513-4275-0000-0000-000003351565 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19051513-4276-0000-0000-0000384499A3 Message-Id: <20190515135322.19393-2-parth@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-15_08:,, 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-1905150087 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jitter tasks are usually of less important in terms of performance and are short/bursty in characteristics. TurboSched uses this jitter classification to pack jitters into the already running busy cores to keep the total idle core count high. The patch describes the use of UCLAMP mechanism to classify tasks. Patrick Bellasi came up with a mechanism to classify tasks from the userspace https://lore.kernel.org/lkml/20190402104153.25404-1-patrick.bellasi@arm.com/ This UCLAMP mechanism can be useful in classifying tasks as jitter. Jitters can be classified for the cgroup by keeping util.max of the tasks as the least(=0). This also provides benefit of giving the least frequency to those jitter tasks, which is useful if all jitters are packed onto a separate core. Use Case with UCLAMP =================== To create a cgroup with all the tasks classified as jitters; ``` mkdir -p /sys/fs/cgroup/cpu/jitter echo 0 > /proc/sys/kernel/sched_uclamp_util_min; echo 0 > /sys/fs/cgroup/cpu/jitter/cpu.util.min; echo 0 > /sys/fs/cgroup/cpu/jitter/cpu.util.max; i=8; ./turbo_bench -t 30 -h $i -n $i & ./turbo_bench -t 30 -h 0 -n $i & echo $! > /sys/fs/cgroup/cpu/jitter/cgroup.procs; ``` Signed-off-by: Parth Shah --- kernel/sched/core.c | 9 +++++++++ kernel/sched/sched.h | 1 + 2 files changed, 10 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d42c0f5eefa9..77aa4aee4478 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7192,6 +7192,15 @@ static int cpu_util_max_write_u64(struct cgroup_subsys_state *css, tg->uclamp_req[UCLAMP_MAX].value = max_value; tg->uclamp_req[UCLAMP_MAX].bucket_id = uclamp_bucket_id(max_value); + /* + * Classify the tasks belonging to the last bucket of MAX UCLAMP as + * jitters + */ + if (uclamp_bucket_id(max_value) == 0) + tg->turbo_sched_enabled = 1; + else if (tg->turbo_sched_enabled) + tg->turbo_sched_enabled = 0; + /* Update effective clamps to track the most restrictive value */ cpu_util_update_eff(css, UCLAMP_MAX); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index b4019012d84b..e75ffaf3ff34 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -407,6 +407,7 @@ struct task_group { struct uclamp_se uclamp[UCLAMP_CNT]; #endif + bool turbo_sched_enabled; }; #ifdef CONFIG_FAIR_GROUP_SCHED -- 2.17.1