Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp765849pxp; Fri, 11 Mar 2022 14:33:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcgV51ZXT6aO+kaut56PVPYP/mNLf5r1RkS5LvKXoqd6wmGqKDTzD3MFbEDcbKoaAy4n7X X-Received: by 2002:a63:8348:0:b0:380:bcc4:861f with SMTP id h69-20020a638348000000b00380bcc4861fmr10223312pge.151.1647037984833; Fri, 11 Mar 2022 14:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647037984; cv=none; d=google.com; s=arc-20160816; b=uyFLIUi7a9ONt1vCK8B5sAcgWe7NF2AZKdDIAFXh6qyJYPBKc8I/T6RJUHLnYSZ9/Q RAvnh+zxmxrZCUhqXE6lODBqSUIj/ohyNTmSiZclh06Chcrs33uobPTmBzu88+BusGFt /BdzHysgHQLu2f6+jOPhvyCrtiK9m0Gj5GUfPfTHsZO6kXsfWmwybViB7dN8hdPV7FA2 cX0frnKTwWaUGlov48A9UONblvEX68kPWhJNbd5mJodHi5A5muIF/HFbSX34OhKc2w63 WOS6NP9AFF+U2z7Vm6+0dfHvMaT5wh5t0R+Xsk3UckFu23V76f4+6P4R0jjEzqFQFbNV jMRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=9NTMzRLoGwhdmZLI0ObjR+XF+Hbh3xQ8VsF4xT8xykA=; b=rYSdbHMNtGCEtSV3lTuqzd8nJZWi5jUpyy4wm4En4s9zmcTUhXHTQWgRwx4/+hnT3X kO2ABt9ZXsb/ztZxBcjuNM11xqlLSpGAio0DmHzGbIkqdXH0FNxlvKwbGlmb9A3wxu9R p8RP5I5veJWSLrWt+kJOecdm6o7OcMQZKJXvWe433NDVjDhjolNU5By+dWl0lHMeMMq9 dYirfmxSckHAa/ddpG8k52ZXx/HqB/kbMpPRxWldSJMNzyOoUqmurASyvnafKHUZKA5i n7UcDw8FGCGoCyQCG7/sy113i7EnShqUbmEbOZUo7LrZgubs5tGvr09v7WjiyUKVjq5M Qjdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsnZVgmh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e3-20020a63d943000000b003758cfb5bc5si8846438pgj.524.2022.03.11.14.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:33:04 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsnZVgmh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D06E223F3E4; Fri, 11 Mar 2022 13:39:15 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349882AbiCKQPZ (ORCPT + 99 others); Fri, 11 Mar 2022 11:15:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350152AbiCKQPU (ORCPT ); Fri, 11 Mar 2022 11:15:20 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5926E191439 for ; Fri, 11 Mar 2022 08:14:16 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id r10so13694826wrp.3 for ; Fri, 11 Mar 2022 08:14:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9NTMzRLoGwhdmZLI0ObjR+XF+Hbh3xQ8VsF4xT8xykA=; b=LsnZVgmhh5uS1QHpj2P4oaLfREx9Of1I8baPHD79rDOuDC9Pk4zK2cnXFgW+qJ+yqU aTcnryb/9nK684ESqGZxRLI3VQqImxz4vcM5e6jN2M7D1lbgci5PAdRMYfxoxzqhJRvw rjNrLUYwfNHjF1gudsP1xtqJ021ftJKnMRagij/zVzxJyCD8QTfGFQ65ZhyQNj6gjAVi V1a7Q5KPvl+RSE/Z25b98ilQQTjIjCGotvQx1Y5V3CPYmmxC0uSdyeRlmyc9ReO3qMVU L6JzgxIwDiQFDWyL1AKc3/Nv/eGQI2f/iplUT8tkE8o9MhchCb0yCl5A6xIi+QmS+SbO XyLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9NTMzRLoGwhdmZLI0ObjR+XF+Hbh3xQ8VsF4xT8xykA=; b=qL1OcvkzLZOK9RBI3edJkLdyUWLoL+XGyCT2SlIuFk5/PUblRB6SmcJxTz+9w8Hbh3 WTSKQEcZjuF8JW8VL2TT+Yq7w6CpPhirxtrRhCK2sTfqFL1xVU3NIu7lMn4kDahPtstm wGWLDwj5onoRblmI6bH+ACprMbQ3WWHgUPquMvQw6C5Jv42+phb2MasLoXZveUuXX/X9 DyZMv76fUfAAGHJ2ZnlAnmfKuxNobbWieH0m6dqTX1DF0sukRJEPhQwl34yY23XRDkMB GD3Zm8evNf5R8gqligrvo2yb14h+tpmEpZI2VRxR/5zHlKBnCw1SVaIU9zUHb1MvZsyf /TMQ== X-Gm-Message-State: AOAM533T0I0Jif6a5iVFQuBgFkz9BTbk6xOjo+lVmrZvwN9uEd5OtHY0 VzBih8OKFgwltDiL+F5yfIWxTw== X-Received: by 2002:a5d:678f:0:b0:1f0:2471:5a93 with SMTP id v15-20020a5d678f000000b001f024715a93mr8031486wru.164.1647015254891; Fri, 11 Mar 2022 08:14:14 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:70d9:405c:a1e4:4d23]) by smtp.gmail.com with ESMTPSA id 4-20020a056000154400b00203812ca383sm6464137wry.78.2022.03.11.08.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 08:14:14 -0800 (PST) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, parth@linux.ibm.com Cc: qais.yousef@arm.com, chris.hyser@oracle.com, pkondeti@codeaurora.org, valentin.schneider@arm.com, patrick.bellasi@matbug.net, 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, Vincent Guittot Subject: [PATCH 2/6] sched/core: Propagate parent task's latency requirements to the child task Date: Fri, 11 Mar 2022 17:14:02 +0100 Message-Id: <20220311161406.23497-3-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220311161406.23497-1-vincent.guittot@linaro.org> References: <20220311161406.23497-1-vincent.guittot@linaro.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Parth Shah 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 [rebase] Signed-off-by: Vincent Guittot --- 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 73cc8f03511a..2afa249c253b 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -78,6 +78,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, .user_cpus_ptr = NULL, diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1d863d7f6ad7..157eef880d1d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4393,6 +4393,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); /* @@ -4409,6 +4412,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) p->prio = p->normal_prio = p->static_prio; 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.1