Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp454574ybf; Fri, 28 Feb 2020 01:08:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxZCYTeGOEfA/MXhyD3NNmZPt3q+/yh2L6ui/sz5eAmDyKXx5L2FAqXzwLc8+6JmgQJ6xq6 X-Received: by 2002:aca:43c1:: with SMTP id q184mr2319790oia.116.1582880924327; Fri, 28 Feb 2020 01:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582880924; cv=none; d=google.com; s=arc-20160816; b=sY85C1ccorhm8pcD9CqJl/EIWxOm/Yppz1ArUAafgK6Lbh598Ou4fr8gzYqP29ZwPQ R5S+tSlFfg74TppCUDLhQtSQQ3ZcqhO8jDPUcznLwfzIneIzSDv3iOrxAFlNGYQUVRmc vE6pCWC21rKGz0Mzkqq0n5mbZqR+t7mrZoWvfwhd9aClUA7WtP4HPyS0GKRyqfEzSpsA hGbVAPfhmq6EFPD2Op0I9WkGGEBinDIT4zE75xae8yBZ0WOcnvrnHm3PqqHYeIzBfHZl vHcLLo+3iRmuWeSxFOIdqXAxjj3Bd03McGcNfxcrjud1pnngVX3SzA8gtKNxocH4J2qN SKGg== 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=niyHgRG/7EcJfD7/ufm/aH1UbiEMNNXOyvIxs/SHWKg=; b=mbE+umaeHFIRcLubLBD1oRLWEy4WDoiwSLhf+F1ai6ZHD81BW99z1RCC2A8nhJSAd1 hIatJd482dsDvAzfTVzbtIeW33WcGZz6mEuEWbOFTZIpcr3vdNU3GcVsYcYs9u85aYjy AEQMc0Bas+w7VD10ygay02BcWBnIDOChxNgZ6MfFbGLO4VRO/lsQ7JDMAImwnlOzDGjP Cy5K/6Z/TCuLGu7vU3R/3lspZnMmZwGPNKGXVFfl3FX11od7g98DMY0QwgEpYeNX+hrN aCU7g8HRuLSJEyym0mj7T3A2qtbmSZ444KkWc/kPtYzYBt3+ojfbkxM1iF55sy+cPR/R nUgg== 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 p3si1592806oih.186.2020.02.28.01.08.32; Fri, 28 Feb 2020 01:08:44 -0800 (PST) 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 S1726766AbgB1JIP (ORCPT + 99 others); Fri, 28 Feb 2020 04:08:15 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:16458 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbgB1JIO (ORCPT ); Fri, 28 Feb 2020 04:08:14 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01S90JlI141388 for ; Fri, 28 Feb 2020 04:08:13 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yepxfeqd0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 28 Feb 2020 04:08:13 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Feb 2020 09:08:11 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) 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) Fri, 28 Feb 2020 09:08:05 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01S984XD59768846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Feb 2020 09:08:04 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C682AE053; Fri, 28 Feb 2020 09:08:04 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD7F0AE055; Fri, 28 Feb 2020 09:08:01 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.18]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 28 Feb 2020 09:08:01 +0000 (GMT) From: Parth Shah To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, qais.yousef@arm.com, chris.hyser@oracle.com, pkondeti@codeaurora.org, patrick.bellasi@matbug.net, valentin.schneider@arm.com, David.Laight@ACULAB.COM, pjt@google.com, pavel@ucw.cz, tj@kernel.org, dhaval.giani@oracle.com, qperret@google.com, tim.c.chen@linux.intel.com Subject: [PATCH v5 2/4] sched/core: Propagate parent task's latency requirements to the child task Date: Fri, 28 Feb 2020 14:37:53 +0530 X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200228090755.22829-1-parth@linux.ibm.com> References: <20200228090755.22829-1-parth@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 20022809-4275-0000-0000-000003A647AF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022809-4276-0000-0000-000038BAC9C9 Message-Id: <20200228090755.22829-3-parth@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-28_02:2020-02-26,2020-02-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 mlxscore=0 clxscore=1015 adultscore=0 suspectscore=1 impostorscore=0 priorityscore=1501 malwarescore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002280075 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clone parent task's latency_nice attribute to the forked child task. Reset the latency_nice value to default value when the child task is set to sched_reset_on_fork. Also, initialize init_task.latency_nice value with DEFAULT_LATENCY_NICE value Signed-off-by: Parth Shah Reviewed-by: Qais Yousef --- init/init_task.c | 1 + kernel/sched/core.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/init/init_task.c b/init/init_task.c index 9e5cbe5eab7b..0d7d865519b8 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -69,6 +69,7 @@ struct task_struct init_task .prio = MAX_PRIO - 20, .static_prio = MAX_PRIO - 20, .normal_prio = MAX_PRIO - 20, + .latency_nice = 0, .policy = SCHED_NORMAL, .cpus_ptr = &init_task.cpus_mask, .cpus_mask = CPU_MASK_ALL, diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8e6f38073ab3..866ea3d2d284 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2847,6 +2847,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) */ p->prio = current->normal_prio; + /* Propagate the parent's latency requirements to the child as well */ + p->latency_nice = current->latency_nice; + uclamp_fork(p); /* @@ -2863,6 +2866,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) p->prio = p->normal_prio = __normal_prio(p); set_load_weight(p, false); + p->latency_nice = DEFAULT_LATENCY_NICE; /* * We don't need the reset flag anymore after the fork. It has * fulfilled its duty: -- 2.17.2