Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3201831ybd; Mon, 24 Jun 2019 21:38:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZYaJYTDaFIGrlcnDOlEL072C77ofT7lY6FCIrMj93trcqrL8TkvlKHv1DLZT07qq8Epx3 X-Received: by 2002:a17:902:a986:: with SMTP id bh6mr150988207plb.100.1561437486761; Mon, 24 Jun 2019 21:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561437486; cv=none; d=google.com; s=arc-20160816; b=wzpna5R0118jZL1Wh7bo4szCykBXftkH7Ma06GmJBKGoSFWoaMlVNSGQtn3nx9yY8a R9ud2s9QtORg22A51kS5Jdlbg/YBndPQwnpsWd5xwbE1WBLbGzyZZhI8Ipq2ptSOn6W2 CMNCSc6EJbg1sv53ouOTEvIyQeA8gOAyVMiNSTJ9t0hjvygw/cLuNy/9yahMATSv3scr WIjaMfXn9lcNwN/acAIhiUszXdq52yEhmnpQIxkC/fYwIKu4ZqVrwgo2BvBfyjIu3wWS wURxAqhF1JWsH6dTlVEmS7tnkErXcre77LafdzBLTQXxMBRyd/C8zuxQDxcr8W2Vt7L9 ogcg== 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=nDXjizGX4YJtul5zbEc3St415pNUIEseYxk2lLVXFsY=; b=FyNXVh4fe1HFLOeFx2rpL+eN0UN3Rv88AT6WrtkJNT8n9vkFwPLcgX+LRpaO8CQqJH EYE2JCrBgS3RwsGgXVU2C1Y5Li9wRHmorg8YDJMTIYd2xrgwbWQ12NWEi/CMfVnTBGNe ASAavLnUcDdzlmh0gn6Ea4zjnWBksG7Olv1Hax2qQ/aDNMjtZpvcxTbEY8O1HaM0IZec tTfX9sAin3I1iaOV3fiw7k7N/q5SGLnZiZGLbEBZI2YBJ/zXmUs+nuh6YPSRZfA+NGvf aZijHYpWlfsKaFCT3FDWLZtuJx8IDonyWzbXL2qDDuQyB6PdVOgYbtBAffzZMNSPhLe7 INEw== 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 v97si1596078pjb.23.2019.06.24.21.37.51; Mon, 24 Jun 2019 21:38:06 -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 S1726845AbfFYEhj (ORCPT + 99 others); Tue, 25 Jun 2019 00:37:39 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:12416 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfFYEhh (ORCPT ); Tue, 25 Jun 2019 00:37:37 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5P4Xmiw011750 for ; Tue, 25 Jun 2019 00:37:37 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tb9sadvar-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 25 Jun 2019 00:37:36 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Jun 2019 05:37:34 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) 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:31 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5P4bUiB38666438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2019 04:37:30 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C79911C050; Tue, 25 Jun 2019 04:37:30 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AE2B11C04A; Tue, 25 Jun 2019 04:37:29 +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:28 +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 1/8] sched/core: Add manual jitter classification using sched_setattr syscall Date: Tue, 25 Jun 2019 10:07:19 +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-0016-0000-0000-0000028C117F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19062504-0017-0000-0000-000032E98140 Message-Id: <20190625043726.21490-2-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 Jitter tasks are short/bursty tasks,typically performing some housekeeping and are less important in the overall scheme of things. In this patch we provide a mechanism based on Patrick Bellasi's UCLAMP framework to classify jitter tasks" We define jitter tasks as those whose util.max in the UCLAMP framework is 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." UCLAMP already provides a way to set util.max for a task by using a syscall interface. This patch uses the `sched_setattr` syscall to set sched_util_max attribute of the task which is used to classify the task as jitter. Use Case with turbo_bench.c =================== ``` i=8; ./turbo_bench -t 30 -h $i -n $((2*i)) -j ``` This spawns 2*i total threads: of which i-CPU bound and i-jitter threads. Signed-off-by: Parth Shah --- include/linux/sched.h | 6 ++++++ kernel/sched/core.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index e2d80e6a187d..2bd9f75a3abb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -696,6 +696,12 @@ struct task_struct { struct uclamp_se uclamp_req[UCLAMP_CNT]; /* Effective clamp values used for a scheduling entity */ struct uclamp_se uclamp[UCLAMP_CNT]; + /* + * Tag the task as jitter. + * 0 = regular. Follows regular CFS policy for task placement. + * 1 = Jitter tasks. Should be packed to reduce active core count. + */ + unsigned int is_jitter; #endif #ifdef CONFIG_PREEMPT_NOTIFIERS diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ab0aa319fe60..19c7204d6351 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1189,6 +1189,15 @@ static void __setscheduler_uclamp(struct task_struct *p, if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) { uclamp_se_set(&p->uclamp_req[UCLAMP_MAX], attr->sched_util_max, true); + + /* + * Set task to jitter class if Max util is clamped to the least + * possible value + */ + if (p->uclamp_req[UCLAMP_MAX].bucket_id == 0 && !p->is_jitter) + p->is_jitter = 1; + else if (p->is_jitter) + p->is_jitter = 0; } } -- 2.17.1