From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D0E845BEC for ; Fri, 29 Nov 2024 16:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897085; cv=none; b=teOo8UxZ0JWc5ne/QlA6UTQ+7ZkHB6mRGzSHIOYdL8ORFb/zA2mfMSYJH20SI1AsW9liCypinmsUAR/UlcTm7+tBeN9jqhUUyIJk/WxeNKyaNcKhew61YZWXdL7TE1xLt5qaOPpxc4E/HJkpIuYO3qoeNb6ld8DVvXXqQaBKeu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897085; c=relaxed/simple; bh=mVjbS47HdiYvofNh5GZkckIEOg0gcnZo8m6/Giv5pm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H8V4A9s/7hyak4nqvt/FObOEMHrk2p0pVaJKz3h5cE6IKqi5tXc6CMfkO4qX/clDnRJCVHC59SuUI0/VDrJHmjgqeaGACt8/Il+ow3A2Aru1nPsJJU3aypRX+UUhoFKFVLrHZh/ac7GGkFH3nP7xQ39d5Wz0aeoNHoN+fCUSJLA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lH0KGkGP; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lH0KGkGP" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-434a45f05feso22577385e9.3 for ; Fri, 29 Nov 2024 08:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897082; x=1733501882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FlFKgVHb4nQ5bY+wYMwnva3c054rOZjazLjMOFEFCGI=; b=lH0KGkGP99GfCa07Z3ETGm90TOk/Gse9KXb1es3clYOwdljXrcL891qh9UT0BidLo0 vFBGgod/HtMS8qNiSnk6dn/F+u0EH8wIk8atXrqakyA4AijJBk2dabS6kt7Lsh9rq8yE +f8KCVO4TljXYUjFiAoQG8jnRyxYwG2jZ4ZXvl2HMkSlzVXS5IFGh/1waxNcTpVlkPpf qsEuZQAqEG3DQZr8iRnpoRbwxcCs3r39Tt5dncK0k+ma0WVUp06FGg99CR9Adwfy52jm rJEwvfHD8wHKiXCaqrEBeelyZpMZvRwukP6NjMPhPhuc781XHmFtE6tuItfmNcIa7rDn Mo0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897082; x=1733501882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FlFKgVHb4nQ5bY+wYMwnva3c054rOZjazLjMOFEFCGI=; b=M1I2LoE3Cy474pVZncRszK9DH+KEZyDJASClVrcUMEs+4zgeomxeYS+wTqx/kwzPUV jQpAtDmicixO3vtLbcbKyxRjBjFtjBVFmSPesgBPacJnEQsAKUmdUllsdAdJdzOmjDPl N3fxbhDeTJ0JLQ/Tui1Xm5togdsRLkgnhmpjFZeO6agfKNrqEyfLsQMR4RV1RMUX5sP9 YcYyvLVfdU3XvfzC708L2AvBUmonDYDmyBvmI8OjMQWMGy/mpgp64si5Eo8sWehC4pkf ngiEbX54ziW7LA7wZ5Ds3CeAdaI3A1dQjRgawAj0xdAq/Tx9AjlJeCJblffEBA7OCiMA Sl1g== X-Forwarded-Encrypted: i=1; AJvYcCUpEjLzsc9kBvnbSWHHKRIqTJWBUjN30dgsipIldUs9whBDNdtVw94RZMQt+Ol9KtjWvQWuoBmBoV4mmpI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3YlEBMKvZwaQZah2G3u8s/xkXtznREQx/Ny6x8tUaHeiRC438 ipwedq7XyDjfWOnYh3UoRgdbVh75ewVHusCcL/ob2YrniJOnttrGhELnWOSyD/4= X-Gm-Gg: ASbGncs89hFeszVs/86YM5DtmbJTHhfvXQ3NjnD4qSAfdayCfsCUaLpvlB7pzSUFuHZ jFG4+UcXGJQ2jmmOjA4hUM97a/hlrN2ADp+SWi6KS9CKJPfqZSpYpNB/j9QlEFkM5EchOaCG0cv A4vH9Z3krMobAeigqDbd1Mr8UFtHR1vf5Qq2xCoBSJx7DvquQIk3ZC8V77HSrWj6fZT6vH6SAPc Zjy1q9euVEKoWKBY3zv3EK/HT1BHcEMlY2pnL9Ei6gsBdsOvpXtxD2XpzM= X-Google-Smtp-Source: AGHT+IHxNip/mKKsi5cIrDGLz8EFEzYYZIENgG+Z67N0gzEjPnvbF3TSg7XY3Euzjs1+MkxlWP7oFg== X-Received: by 2002:a05:600c:4e8a:b0:431:562a:54be with SMTP id 5b1f17b1804b1-434a9dc36c1mr131953595e9.9.1732897081748; Fri, 29 Nov 2024 08:18:01 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:01 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 01/10 v2] sched/eevdf: More PELT vs DELAYED_DEQUEUE Date: Fri, 29 Nov 2024 17:17:47 +0100 Message-ID: <20241129161756.3081386-2-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra Vincent and Dietmar noted that while commit fc1892becd56 ("sched/eevdf: Fixup PELT vs DELAYED_DEQUEUE") fixes the entity runnable stats, it does not adjust the cfs_rq runnable stats, which are based off of h_nr_running. Track h_nr_delayed such that we can discount those and adjust the signal. Fixes: fc1892becd56 ("sched/eevdf: Fixup PELT vs DELAYED_DEQUEUE") Reported-by: Dietmar Eggemann Closes: https://lore.kernel.org/lkml/a9a45193-d0c6-4ba2-a822-464ad30b550e@a= rm.com/ Reported-by: Vincent Guittot Closes: https://lore.kernel.org/lkml/CAKfTPtCNUvWE_GX5LyvTF-WdxUT=3DZgvZZv-= 4t=3DeWntg5uOFqiQ@mail.gmail.com/ Signed-off-by: Peter Zijlstra (Intel) [ Fixes checkpatch warnings ] Signed-off-by: Vincent Guittot Link: https://lkml.kernel.org/r/20240906104525.GG4928@noisy.programming.kic= ks-ass.net Tested-by: K Prateek Nayak --- kernel/sched/debug.c | 1 + kernel/sched/fair.c | 51 +++++++++++++++++++++++++++++++++++++++----- kernel/sched/pelt.c | 2 +- kernel/sched/sched.h | 8 +++++-- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index a48b2a701ec2..a1be00a988bf 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -845,6 +845,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread", SPLIT_NS(spread)); SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); SEQ_printf(m, " .%-30s: %d\n", "h_nr_running", cfs_rq->h_nr_running); + SEQ_printf(m, " .%-30s: %d\n", "h_nr_delayed", cfs_rq->h_nr_delayed); SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", cfs_rq->idle_nr_running); SEQ_printf(m, " .%-30s: %d\n", "idle_h_nr_running", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3356315d7e64..f4ed2ed070e4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5465,9 +5465,33 @@ static void clear_buddies(struct cfs_rq *cfs_rq, str= uct sched_entity *se) =20 static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); =20 -static inline void finish_delayed_dequeue_entity(struct sched_entity *se) +static void set_delayed(struct sched_entity *se) +{ + se->sched_delayed =3D 1; + for_each_sched_entity(se) { + struct cfs_rq *cfs_rq =3D cfs_rq_of(se); + + cfs_rq->h_nr_delayed++; + if (cfs_rq_throttled(cfs_rq)) + break; + } +} + +static void clear_delayed(struct sched_entity *se) { se->sched_delayed =3D 0; + for_each_sched_entity(se) { + struct cfs_rq *cfs_rq =3D cfs_rq_of(se); + + cfs_rq->h_nr_delayed--; + if (cfs_rq_throttled(cfs_rq)) + break; + } +} + +static inline void finish_delayed_dequeue_entity(struct sched_entity *se) +{ + clear_delayed(se); if (sched_feat(DELAY_ZERO) && se->vlag > 0) se->vlag =3D 0; } @@ -5497,7 +5521,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) if (cfs_rq->next =3D=3D se) cfs_rq->next =3D NULL; update_load_avg(cfs_rq, se, 0); - se->sched_delayed =3D 1; + set_delayed(se); return false; } } @@ -5910,7 +5934,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long task_delta, idle_task_delta, dequeue =3D 1; + long task_delta, idle_task_delta, delayed_delta, dequeue =3D 1; long rq_h_nr_running =3D rq->cfs.h_nr_running; =20 raw_spin_lock(&cfs_b->lock); @@ -5943,6 +5967,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) =20 task_delta =3D cfs_rq->h_nr_running; idle_task_delta =3D cfs_rq->idle_h_nr_running; + delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); int flags; @@ -5966,6 +5991,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) =20 qcfs_rq->h_nr_running -=3D task_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; + qcfs_rq->h_nr_delayed -=3D delayed_delta; =20 if (qcfs_rq->load.weight) { /* Avoid re-evaluating load for this entity: */ @@ -5988,6 +6014,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) =20 qcfs_rq->h_nr_running -=3D task_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; + qcfs_rq->h_nr_delayed -=3D delayed_delta; } =20 /* At this point se is NULL and we are at root level*/ @@ -6013,7 +6040,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long task_delta, idle_task_delta; + long task_delta, idle_task_delta, delayed_delta; long rq_h_nr_running =3D rq->cfs.h_nr_running; =20 se =3D cfs_rq->tg->se[cpu_of(rq)]; @@ -6049,6 +6076,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) =20 task_delta =3D cfs_rq->h_nr_running; idle_task_delta =3D cfs_rq->idle_h_nr_running; + delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); =20 @@ -6066,6 +6094,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) =20 qcfs_rq->h_nr_running +=3D task_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; + qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6083,6 +6112,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) =20 qcfs_rq->h_nr_running +=3D task_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; + qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6936,7 +6966,7 @@ requeue_delayed_entity(struct sched_entity *se) } =20 update_load_avg(cfs_rq, se, 0); - se->sched_delayed =3D 0; + clear_delayed(se); } =20 /* @@ -6950,6 +6980,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) struct cfs_rq *cfs_rq; struct sched_entity *se =3D &p->se; int idle_h_nr_running =3D task_has_idle_policy(p); + int h_nr_delayed =3D 0; int task_new =3D !(flags & ENQUEUE_WAKEUP); int rq_h_nr_running =3D rq->cfs.h_nr_running; u64 slice =3D 0; @@ -6976,6 +7007,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) if (p->in_iowait) cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT); =20 + if (task_new) + h_nr_delayed =3D !!se->sched_delayed; + for_each_sched_entity(se) { if (se->on_rq) { if (se->sched_delayed) @@ -6998,6 +7032,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) =20 cfs_rq->h_nr_running++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; + cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D 1; @@ -7021,6 +7056,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) =20 cfs_rq->h_nr_running++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; + cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D 1; @@ -7083,6 +7119,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) struct task_struct *p =3D NULL; int idle_h_nr_running =3D 0; int h_nr_running =3D 0; + int h_nr_delayed =3D 0; struct cfs_rq *cfs_rq; u64 slice =3D 0; =20 @@ -7090,6 +7127,8 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) p =3D task_of(se); h_nr_running =3D 1; idle_h_nr_running =3D task_has_idle_policy(p); + if (!task_sleep && !task_delayed) + h_nr_delayed =3D !!se->sched_delayed; } else { cfs_rq =3D group_cfs_rq(se); slice =3D cfs_rq_min_slice(cfs_rq); @@ -7107,6 +7146,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) =20 cfs_rq->h_nr_running -=3D h_nr_running; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; + cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D h_nr_running; @@ -7145,6 +7185,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) =20 cfs_rq->h_nr_running -=3D h_nr_running; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; + cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D h_nr_running; diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index fc07382361a8..fee75cc2c47b 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -321,7 +321,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cf= s_rq) { if (___update_load_sum(now, &cfs_rq->avg, scale_load_down(cfs_rq->load.weight), - cfs_rq->h_nr_running, + cfs_rq->h_nr_running - cfs_rq->h_nr_delayed, cfs_rq->curr !=3D NULL)) { =20 ___update_load_avg(&cfs_rq->avg, 1); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 090dd4b38fa2..77a05ca0cce7 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -649,6 +649,7 @@ struct cfs_rq { unsigned int h_nr_running; /* SCHED_{NORMAL,BATCH,IDLE} */ unsigned int idle_nr_running; /* SCHED_IDLE */ unsigned int idle_h_nr_running; /* SCHED_IDLE */ + unsigned int h_nr_delayed; =20 s64 avg_vruntime; u64 avg_load; @@ -897,8 +898,11 @@ struct dl_rq { =20 static inline void se_update_runnable(struct sched_entity *se) { - if (!entity_is_task(se)) - se->runnable_weight =3D se->my_q->h_nr_running; + if (!entity_is_task(se)) { + struct cfs_rq *cfs_rq =3D se->my_q; + + se->runnable_weight =3D cfs_rq->h_nr_running - cfs_rq->h_nr_delayed; + } } =20 static inline long se_runnable(struct sched_entity *se) --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82D691A0BFA for ; Fri, 29 Nov 2024 16:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897097; cv=none; b=Sgw0LTiCHb7VYwZckdTJptHXAYDBVMyigSk6T4gLuohfj+VrVPAgFrULWfHBZ56TkOU68CghMCGdzGrxT8OOInvLBLcoEHFHTv7siAJkJvkRvDG2/k2balAAfWyibUopIB/HhpLJewl1ZLjA0TxJXp3a9OI8IQ3aOGbOoy2EEpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897097; c=relaxed/simple; bh=sJ6TUvAYpMRQPUW4ZyvAwhOJBT7BtjbYSA4d2wZ5F/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ecq0kZQpEJpqRyopVHuX9JdOQScGeM9Zu7ktv15ICb284Il1T7jjoy37pmLo9cssA05TiyZ5HWbzN1n4kmdR1y4JiF0nTgrYhZvf8bB1MCQZEl35AEfunXvvP43PJYXYSVxmaP92rSzOwXkUg91leW4Z7dJ/RMp8zLmyQrOlXYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dfWKi243; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dfWKi243" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2ffd711274dso26321721fa.0 for ; Fri, 29 Nov 2024 08:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897094; x=1733501894; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=echnW2zNUNXbTTkfjUQkfrRCQzojIi8MNZBS6ar+qJ4=; b=dfWKi243gZ3ATGe8EfcNmnDrKjXGr7jGIQEYnmH7oI0fP/cP03CxhnvpMfxsPAZ5zd ayQ/km5/1TntXNMeDT5X8ZRer9x1sHU66hPphMGazgUhmjnACI/Foy8+iu+MxeISSy0h BqWRM1LR/VQUE6WZQ7qifch0I5KfobTzREFgGuPgUG9CKbxE7Zq4V5Leqv0J+mE8A2gk rQ3Ihv2AzFt8d84zdIUuPEy3zqzWdyleEN5gQWh10FfHhxDKFUFQwJDDtb6+f0E0x4hQ st7A7+kQZYVK/FDe1ZJudzG+SfN6mkoizXYtZGz2a++zT2x+VhwjG78MYyZ1yc5eR7vq 1jSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897094; x=1733501894; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=echnW2zNUNXbTTkfjUQkfrRCQzojIi8MNZBS6ar+qJ4=; b=D7drM2p8U4iAVUPWU1De0gYYyQfOKvcERkHZHnr1mKKee4MCMldc1yO8mFqbUYobwV Gu6KLV6JJCV+aBqBNj01GTI+kKt+g8r8VohR0MixktB1o55PXEeeXjdYdlAwemBa97/Z J80d/RNP4m3VR9JJnkqKYAbrYtpoECSF3enenDdTJWgDI7AcDZuqcr8VGsiVlkMoJcFa vh2fKIXUj0LWNZEVMvHI5w2VdZsIq2loNQ1tjGuTEtsjH8gzmuuKlApnx/IrktPUf5yN DtOkjY/cbCFTz62FxtfqGUNaErJz3eEhHV7uOlHbIh2TK+ZvF8P1nECppWziwb61jhQw QGsw== X-Forwarded-Encrypted: i=1; AJvYcCVoUIPNe7oOEY44l+ZJlIiZKMidBSvN/SEV8CqFC9NyTgqrTXrT0wkV3D8aSWN26cpr8U5L51NJZwXAvC0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8Bi/HQlZEXk8IQWqEDMazrI/6QYs2Lz9oKyqJzONXmSBfnH0C /hkV8KtXCI3Q5qGEWIUCl2FN/HZgcFa05vx8O6sxB0GP4lQgzA0kLVluqA4RF31dwjIPo6/fsjl puCQ= X-Gm-Gg: ASbGnctqRfAKoKvue8R7XXt8DDG0QnCsx7HIgzJhmT+hyskyMlHIv9Pb4muyrXMYkRK CLTFVFHoJv084vIzzY3mw58iHZDBYh3882ejv5TOK/3Qp22Z8je35Xxaq5/hULzWISKG4KPRYVG vzHHIB4xTZhtLF2FIc+fWkD0uLNFBMyNMa55ckLD5NaQ2THY31HZGFOyiuR51h3WeTk8BKocqrN zDI684nX4kM4AHhACeJB+PwWu4wTuNRHSA/XiTlS0tx8HAdkSlOGJq+yYw= X-Google-Smtp-Source: AGHT+IG/qNmu5Nr+yqIUE98ewq5NzL3uSAlKQj6wU5q7bDJWdjfF2pnFmNd/YKeoTcJbaleTjP68WQ== X-Received: by 2002:a05:600c:3589:b0:434:a4d3:31f0 with SMTP id 5b1f17b1804b1-434afb9533fmr76777135e9.3.1732897083315; Fri, 29 Nov 2024 08:18:03 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:02 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 02/10 v2] sched/fair: Rename h_nr_running into h_nr_queued Date: Fri, 29 Nov 2024 17:17:48 +0100 Message-ID: <20241129161756.3081386-3-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With delayed dequeued feature, a sleeping sched_entity remains queued in the rq until its lag has elapsed but can't run. Rename h_nr_running into h_nr_queued to reflect this new behavior. Signed-off-by: Vincent Guittot --- kernel/sched/core.c | 2 +- kernel/sched/debug.c | 6 +-- kernel/sched/fair.c | 88 ++++++++++++++++++++++---------------------- kernel/sched/pelt.c | 4 +- kernel/sched/sched.h | 4 +- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5c47d70f4204..ba5e314eb99b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6015,7 +6015,7 @@ __pick_next_task(struct rq *rq, struct task_struct *p= rev, struct rq_flags *rf) * opportunity to pull in more work from other CPUs. */ if (likely(!sched_class_above(prev->sched_class, &fair_sched_class) && - rq->nr_running =3D=3D rq->cfs.h_nr_running)) { + rq->nr_running =3D=3D rq->cfs.h_nr_queued)) { =20 p =3D pick_next_task_fair(rq, prev, rf); if (unlikely(p =3D=3D RETRY_TASK)) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index a1be00a988bf..08d6c2b7caa3 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -379,7 +379,7 @@ static ssize_t sched_fair_server_write(struct file *fil= p, const char __user *ubu return -EINVAL; } =20 - if (rq->cfs.h_nr_running) { + if (rq->cfs.h_nr_queued) { update_rq_clock(rq); dl_server_stop(&rq->fair_server); } @@ -392,7 +392,7 @@ static ssize_t sched_fair_server_write(struct file *fil= p, const char __user *ubu printk_deferred("Fair server disabled in CPU %d, system may crash due t= o starvation.\n", cpu_of(rq)); =20 - if (rq->cfs.h_nr_running) + if (rq->cfs.h_nr_queued) dl_server_start(&rq->fair_server); } =20 @@ -844,7 +844,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) spread =3D right_vruntime - left_vruntime; SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread", SPLIT_NS(spread)); SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); - SEQ_printf(m, " .%-30s: %d\n", "h_nr_running", cfs_rq->h_nr_running); + SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); SEQ_printf(m, " .%-30s: %d\n", "h_nr_delayed", cfs_rq->h_nr_delayed); SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", cfs_rq->idle_nr_running); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f4ed2ed070e4..c3cc9f784afe 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2128,7 +2128,7 @@ static void update_numa_stats(struct task_numa_env *e= nv, ns->load +=3D cpu_load(rq); ns->runnable +=3D cpu_runnable(rq); ns->util +=3D cpu_util_cfs(cpu); - ns->nr_running +=3D rq->cfs.h_nr_running; + ns->nr_running +=3D rq->cfs.h_nr_queued; ns->compute_capacity +=3D capacity_of(cpu); =20 if (find_idle && idle_core < 0 && !rq->nr_running && idle_cpu(cpu)) { @@ -5396,7 +5396,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) * When enqueuing a sched_entity, we must: * - Update loads to have both entity and cfs_rq synced with now. * - For group_entity, update its runnable_weight to reflect the new - * h_nr_running of its group cfs_rq. + * h_nr_queued of its group cfs_rq. * - For group_entity, update its weight to reflect the new share of * its group cfs_rq * - Add its new weight to cfs_rq->load.weight @@ -5534,7 +5534,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) * When dequeuing a sched_entity, we must: * - Update loads to have both entity and cfs_rq synced with now. * - For group_entity, update its runnable_weight to reflect the new - * h_nr_running of its group cfs_rq. + * h_nr_queued of its group cfs_rq. * - Subtract its previous weight from cfs_rq->load.weight. * - For group entity, update its weight to reflect the new share * of its group cfs_rq. @@ -5934,8 +5934,8 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long task_delta, idle_task_delta, delayed_delta, dequeue =3D 1; - long rq_h_nr_running =3D rq->cfs.h_nr_running; + long queued_delta, idle_task_delta, delayed_delta, dequeue =3D 1; + long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 raw_spin_lock(&cfs_b->lock); /* This will start the period timer if necessary */ @@ -5965,7 +5965,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) walk_tg_tree_from(cfs_rq->tg, tg_throttle_down, tg_nop, (void *)rq); rcu_read_unlock(); =20 - task_delta =3D cfs_rq->h_nr_running; + queued_delta =3D cfs_rq->h_nr_queued; idle_task_delta =3D cfs_rq->idle_h_nr_running; delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { @@ -5987,9 +5987,9 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) dequeue_entity(qcfs_rq, se, flags); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_running; + idle_task_delta =3D cfs_rq->h_nr_queued; =20 - qcfs_rq->h_nr_running -=3D task_delta; + qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; qcfs_rq->h_nr_delayed -=3D delayed_delta; =20 @@ -6010,18 +6010,18 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) se_update_runnable(se); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_running; + idle_task_delta =3D cfs_rq->h_nr_queued; =20 - qcfs_rq->h_nr_running -=3D task_delta; + qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; qcfs_rq->h_nr_delayed -=3D delayed_delta; } =20 /* At this point se is NULL and we are at root level*/ - sub_nr_running(rq, task_delta); + sub_nr_running(rq, queued_delta); =20 /* Stop the fair server if throttling resulted in no runnable tasks */ - if (rq_h_nr_running && !rq->cfs.h_nr_running) + if (rq_h_nr_queued && !rq->cfs.h_nr_queued) dl_server_stop(&rq->fair_server); done: /* @@ -6040,8 +6040,8 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long task_delta, idle_task_delta, delayed_delta; - long rq_h_nr_running =3D rq->cfs.h_nr_running; + long queued_delta, idle_task_delta, delayed_delta; + long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 se =3D cfs_rq->tg->se[cpu_of(rq)]; =20 @@ -6074,7 +6074,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) goto unthrottle_throttle; } =20 - task_delta =3D cfs_rq->h_nr_running; + queued_delta =3D cfs_rq->h_nr_queued; idle_task_delta =3D cfs_rq->idle_h_nr_running; delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { @@ -6090,9 +6090,9 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) enqueue_entity(qcfs_rq, se, ENQUEUE_WAKEUP); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_running; + idle_task_delta =3D cfs_rq->h_nr_queued; =20 - qcfs_rq->h_nr_running +=3D task_delta; + qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 @@ -6108,9 +6108,9 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) se_update_runnable(se); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_running; + idle_task_delta =3D cfs_rq->h_nr_queued; =20 - qcfs_rq->h_nr_running +=3D task_delta; + qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 @@ -6120,11 +6120,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) } =20 /* Start the fair server if un-throttling resulted in new runnable tasks = */ - if (!rq_h_nr_running && rq->cfs.h_nr_running) + if (!rq_h_nr_queued && rq->cfs.h_nr_queued) dl_server_start(&rq->fair_server); =20 /* At this point se is NULL and we are at root level*/ - add_nr_running(rq, task_delta); + add_nr_running(rq, queued_delta); =20 unthrottle_throttle: assert_list_leaf_cfs_rq(rq); @@ -6839,7 +6839,7 @@ static void hrtick_start_fair(struct rq *rq, struct t= ask_struct *p) =20 SCHED_WARN_ON(task_rq(p) !=3D rq); =20 - if (rq->cfs.h_nr_running > 1) { + if (rq->cfs.h_nr_queued > 1) { u64 ran =3D se->sum_exec_runtime - se->prev_sum_exec_runtime; u64 slice =3D se->slice; s64 delta =3D slice - ran; @@ -6982,7 +6982,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) int idle_h_nr_running =3D task_has_idle_policy(p); int h_nr_delayed =3D 0; int task_new =3D !(flags & ENQUEUE_WAKEUP); - int rq_h_nr_running =3D rq->cfs.h_nr_running; + int rq_h_nr_queued =3D rq->cfs.h_nr_queued; u64 slice =3D 0; =20 /* @@ -7030,7 +7030,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) enqueue_entity(cfs_rq, se, flags); slice =3D cfs_rq_min_slice(cfs_rq); =20 - cfs_rq->h_nr_running++; + cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 @@ -7054,7 +7054,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 - cfs_rq->h_nr_running++; + cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 @@ -7066,7 +7066,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) goto enqueue_throttle; } =20 - if (!rq_h_nr_running && rq->cfs.h_nr_running) { + if (!rq_h_nr_queued && rq->cfs.h_nr_queued) { /* Account for idle runtime */ if (!rq->nr_running) dl_server_update_idle_time(rq, rq->curr); @@ -7113,19 +7113,19 @@ static void set_next_buddy(struct sched_entity *se); static int dequeue_entities(struct rq *rq, struct sched_entity *se, int fl= ags) { bool was_sched_idle =3D sched_idle_rq(rq); - int rq_h_nr_running =3D rq->cfs.h_nr_running; + int rq_h_nr_queued =3D rq->cfs.h_nr_queued; bool task_sleep =3D flags & DEQUEUE_SLEEP; bool task_delayed =3D flags & DEQUEUE_DELAYED; struct task_struct *p =3D NULL; int idle_h_nr_running =3D 0; - int h_nr_running =3D 0; + int h_nr_queued =3D 0; int h_nr_delayed =3D 0; struct cfs_rq *cfs_rq; u64 slice =3D 0; =20 if (entity_is_task(se)) { p =3D task_of(se); - h_nr_running =3D 1; + h_nr_queued =3D 1; idle_h_nr_running =3D task_has_idle_policy(p); if (!task_sleep && !task_delayed) h_nr_delayed =3D !!se->sched_delayed; @@ -7144,12 +7144,12 @@ static int dequeue_entities(struct rq *rq, struct s= ched_entity *se, int flags) break; } =20 - cfs_rq->h_nr_running -=3D h_nr_running; + cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D h_nr_running; + idle_h_nr_running =3D h_nr_queued; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) @@ -7183,21 +7183,21 @@ static int dequeue_entities(struct rq *rq, struct s= ched_entity *se, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 - cfs_rq->h_nr_running -=3D h_nr_running; + cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D h_nr_running; + idle_h_nr_running =3D h_nr_queued; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) return 0; } =20 - sub_nr_running(rq, h_nr_running); + sub_nr_running(rq, h_nr_queued); =20 - if (rq_h_nr_running && !rq->cfs.h_nr_running) + if (rq_h_nr_queued && !rq->cfs.h_nr_queued) dl_server_stop(&rq->fair_server); =20 /* balance early to pull high priority tasks */ @@ -10319,7 +10319,7 @@ sched_reduced_capacity(struct rq *rq, struct sched_= domain *sd) * When there is more than 1 task, the group_overloaded case already * takes care of cpu with reduced capacity */ - if (rq->cfs.h_nr_running !=3D 1) + if (rq->cfs.h_nr_queued !=3D 1) return false; =20 return check_cpu_capacity(rq, sd); @@ -10354,7 +10354,7 @@ static inline void update_sg_lb_stats(struct lb_env= *env, sgs->group_load +=3D load; sgs->group_util +=3D cpu_util_cfs(i); sgs->group_runnable +=3D cpu_runnable(rq); - sgs->sum_h_nr_running +=3D rq->cfs.h_nr_running; + sgs->sum_h_nr_running +=3D rq->cfs.h_nr_queued; =20 nr_running =3D rq->nr_running; sgs->sum_nr_running +=3D nr_running; @@ -10669,7 +10669,7 @@ static inline void update_sg_wakeup_stats(struct sc= hed_domain *sd, sgs->group_util +=3D cpu_util_without(i, p); sgs->group_runnable +=3D cpu_runnable_without(rq, p); local =3D task_running_on_cpu(i, p); - sgs->sum_h_nr_running +=3D rq->cfs.h_nr_running - local; + sgs->sum_h_nr_running +=3D rq->cfs.h_nr_queued - local; =20 nr_running =3D rq->nr_running - local; sgs->sum_nr_running +=3D nr_running; @@ -11451,7 +11451,7 @@ static struct rq *sched_balance_find_src_rq(struct = lb_env *env, if (rt > env->fbq_type) continue; =20 - nr_running =3D rq->cfs.h_nr_running; + nr_running =3D rq->cfs.h_nr_queued; if (!nr_running) continue; =20 @@ -11610,7 +11610,7 @@ static int need_active_balance(struct lb_env *env) * available on dst_cpu. */ if (env->idle && - (env->src_rq->cfs.h_nr_running =3D=3D 1)) { + (env->src_rq->cfs.h_nr_queued =3D=3D 1)) { if ((check_cpu_capacity(env->src_rq, sd)) && (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_= cpu)*100)) return 1; @@ -12353,7 +12353,7 @@ static void nohz_balancer_kick(struct rq *rq) * If there's a runnable CFS task and the current CPU has reduced * capacity, kick the ILB to see if there's a better CPU to run on: */ - if (rq->cfs.h_nr_running >=3D 1 && check_cpu_capacity(rq, sd)) { + if (rq->cfs.h_nr_queued >=3D 1 && check_cpu_capacity(rq, sd)) { flags =3D NOHZ_STATS_KICK | NOHZ_BALANCE_KICK; goto unlock; } @@ -12851,11 +12851,11 @@ static int sched_balance_newidle(struct rq *this_= rq, struct rq_flags *rf) * have been enqueued in the meantime. Since we're not going idle, * pretend we pulled a task. */ - if (this_rq->cfs.h_nr_running && !pulled_task) + if (this_rq->cfs.h_nr_queued && !pulled_task) pulled_task =3D 1; =20 /* Is there a task of a high priority class? */ - if (this_rq->nr_running !=3D this_rq->cfs.h_nr_running) + if (this_rq->nr_running !=3D this_rq->cfs.h_nr_queued) pulled_task =3D -1; =20 out: @@ -13542,7 +13542,7 @@ int sched_group_set_idle(struct task_group *tg, lon= g idle) parent_cfs_rq->idle_nr_running--; } =20 - idle_task_delta =3D grp_cfs_rq->h_nr_running - + idle_task_delta =3D grp_cfs_rq->h_nr_queued - grp_cfs_rq->idle_h_nr_running; if (!cfs_rq_is_idle(grp_cfs_rq)) idle_task_delta *=3D -1; diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index fee75cc2c47b..2bad0b508dfc 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -275,7 +275,7 @@ ___update_load_avg(struct sched_avg *sa, unsigned long = load) * * group: [ see update_cfs_group() ] * se_weight() =3D tg->weight * grq->load_avg / tg->load_avg - * se_runnable() =3D grq->h_nr_running + * se_runnable() =3D grq->h_nr_queued * * runnable_sum =3D se_runnable() * runnable =3D grq->runnable_sum * runnable_avg =3D runnable_sum @@ -321,7 +321,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cf= s_rq) { if (___update_load_sum(now, &cfs_rq->avg, scale_load_down(cfs_rq->load.weight), - cfs_rq->h_nr_running - cfs_rq->h_nr_delayed, + cfs_rq->h_nr_queued - cfs_rq->h_nr_delayed, cfs_rq->curr !=3D NULL)) { =20 ___update_load_avg(&cfs_rq->avg, 1); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 77a05ca0cce7..4677e5412c40 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -646,7 +646,7 @@ struct balance_callback { struct cfs_rq { struct load_weight load; unsigned int nr_running; - unsigned int h_nr_running; /* SCHED_{NORMAL,BATCH,IDLE} */ + unsigned int h_nr_queued; /* SCHED_{NORMAL,BATCH,IDLE} */ unsigned int idle_nr_running; /* SCHED_IDLE */ unsigned int idle_h_nr_running; /* SCHED_IDLE */ unsigned int h_nr_delayed; @@ -901,7 +901,7 @@ static inline void se_update_runnable(struct sched_enti= ty *se) if (!entity_is_task(se)) { struct cfs_rq *cfs_rq =3D se->my_q; =20 - se->runnable_weight =3D cfs_rq->h_nr_running - cfs_rq->h_nr_delayed; + se->runnable_weight =3D cfs_rq->h_nr_queued - cfs_rq->h_nr_delayed; } } =20 --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F547158851 for ; Fri, 29 Nov 2024 16:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897088; cv=none; b=gNNp13z47XEBplgzBq/oTSyF3sbXPLbSjmD9IrA3Emx8iEJk+pQBhHVLpiMh4kxgrwNpOaaWDY0ixzrRr7ocxkB8BMd5LuaLY1NhjHn/stdVMyZLX0vWZcB1/Lc3XwqxR5+PVzkTJMU+xm/snsfYdPNukOWcm1tov5jRYXNygTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897088; c=relaxed/simple; bh=OFCxYR6KvY0frdZoDh9vcMnm72QvWhsQJmXJXppqBo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aTHSFXFmsHB/XKpU8fekU8cSOIKAepXGdfsiCwRm0pN/SMqVvKbD23uDWQemd6mPSopc8TM6bMesBu71vfki2JWzyTXvedQnAMUMZl15jKZUKVhbdbN7c9GXyWGKYCgbnFXaUnpHVGIa7hVD1d7Pin6x+XTS5f2IXNwuMVSiV2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=P8irERl9; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P8irERl9" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-432d86a3085so17990965e9.2 for ; Fri, 29 Nov 2024 08:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897085; x=1733501885; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BqluTYt4sTu+/yGY3V+MIFvKYHw0c4swhzOIbIipU4s=; b=P8irERl9tPf7smQmFQ7js9suvyV9q46KXQx+1OTNRJACL4RK0+21AVxREfeFJEjcuL u8V9on0I7nceM+yVVmKIRXp0rfWk08o3Vm1P6GcaQ4KuChAm5DJnIgRmQAHJR5XBJc4Q b7IvFWlyuucwHyFbSEGQCVpopAXcXeXAXUi/70dPZOHUTieqIyuiVQtdhbFp1OH54DHQ DKfT8Uh//ReceD3NzPlHgP8tjfWrXjLCmD5PPaL/1N549xULMDeo9JIjnRmVZtYahIVM 6plEG86WYsUqZi8gZatdKGQoahWm3KmroXiFppckbkginy1xfg4Mks5EBhPK9iPPu/NV On4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897085; x=1733501885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BqluTYt4sTu+/yGY3V+MIFvKYHw0c4swhzOIbIipU4s=; b=P07SzmVh0gnhs2VenS7wzgcJIIV/5IiqbyE0nNTEdYnUpi+RYXHyBtWyxNFhE7OdeC PRXO7DkrBemU4kndQGoMoiTwRztJH8B8KTdzoUBETxT6nPicsIGuK6xFvhtzy40Fww7W hlErmnAjd3+UROoiBeCTdSNraj7bo/JpimXeqJfQ41Tg0h3dsYoPpxitJZ1Za1LECupX feUqP4TJrIHaTEnhTdD6PM/dRl67XNJsqtRNS9xmsooIBA3dXf6HF/TreYkTXZAORDbk NCiwVk+yiG4rkBv3bTEPsUB+XK4xV0+6b+9lK/5qGCiwkIJ+f3B2J9YKG1EsXKRt21Jf UZCA== X-Forwarded-Encrypted: i=1; AJvYcCW90wrpsGfGTX2wXAmpSzXiWB5anRBuCJ9nwTwR8QqWhj1UQD+jxzqOJKdLfL/YebMrD2XX48Ywzq6XCto=@vger.kernel.org X-Gm-Message-State: AOJu0YwDNSpxyLokkY833WTLeuEu/21fbvCeMJw/CK6T+NUqlY6oI+yS zsMRxSamil4hcLgSwNkWWvMKfHfwHbtFQN7aLErJtotIl6MaYqeHP59fwSju5ac= X-Gm-Gg: ASbGncvqdIobecbLjxhu9IZXQVluRu3ejVqzo8zJ0LqqLEjbad1j8/8l8oeRPoQIETU IKqZ2RQq+/CVfzoM73+ZMpqTOE8wCH8p9aoBIwoHJXcyI1MEr+Xof4DftSWICuLPjQbduO7Eff/ Mv6OY2sGuq3QeScM9pA8RzuG/6VM0aLh4Wnrw3d2o5PWx5Y6x1u9BwGeab3zqnlbljZHrLBkf8w oCuFzvX7XBEvj082ZTFtPJx6OMQqMPrQtH+49xyIopKuxjEkWWtLxGyQ2o= X-Google-Smtp-Source: AGHT+IEpPAZboWRTS9KwHNuuPBIbRI/hQ2pnd2OWGXIeR/B2iY4/6pU2FtFCd8KDYPg58R6UmPGPuw== X-Received: by 2002:a05:600c:4747:b0:431:586e:7e7 with SMTP id 5b1f17b1804b1-434a9dbc646mr98515985e9.1.1732897084443; Fri, 29 Nov 2024 08:18:04 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:03 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 03/10 v2] sched/fair: Add new cfs_rq.h_nr_runnable Date: Fri, 29 Nov 2024 17:17:49 +0100 Message-ID: <20241129161756.3081386-4-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With delayed dequeued feature, a sleeping sched_entity remains queued in the rq until its lag has elapsed. As a result, it stays also visible in the statistics that are used to balance the system and in particular the field cfs.h_nr_queued when the sched_entity is associated to a task. Create a new h_nr_runnable that tracks all queued and runnable tasks and use it when balancing the load on the system. h_nr_runnable will be used in several places to make decision on load balance: - PELT runnable_avg - deciding if a group is overloaded or has spare capacity - numa stats - reduced capacity management - load balance - nohz kick It should be noticed that the rq->nr_running still counts the delayed dequeued tasks as delayed dequeue is a fair feature that is meaningless at core level. Signed-off-by: Vincent Guittot --- kernel/sched/debug.c | 1 + kernel/sched/fair.c | 45 ++++++++++++++++++++++++++++++-------------- kernel/sched/pelt.c | 4 ++-- kernel/sched/sched.h | 10 ++++------ 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 08d6c2b7caa3..fd711cc4d44c 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -844,6 +844,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) spread =3D right_vruntime - left_vruntime; SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread", SPLIT_NS(spread)); SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); + SEQ_printf(m, " .%-30s: %d\n", "h_nr_runnable", cfs_rq->h_nr_runnable); SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); SEQ_printf(m, " .%-30s: %d\n", "h_nr_delayed", cfs_rq->h_nr_delayed); SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c3cc9f784afe..d5736bde3682 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2128,7 +2128,7 @@ static void update_numa_stats(struct task_numa_env *e= nv, ns->load +=3D cpu_load(rq); ns->runnable +=3D cpu_runnable(rq); ns->util +=3D cpu_util_cfs(cpu); - ns->nr_running +=3D rq->cfs.h_nr_queued; + ns->nr_running +=3D rq->cfs.h_nr_runnable; ns->compute_capacity +=3D capacity_of(cpu); =20 if (find_idle && idle_core < 0 && !rq->nr_running && idle_cpu(cpu)) { @@ -5396,7 +5396,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) * When enqueuing a sched_entity, we must: * - Update loads to have both entity and cfs_rq synced with now. * - For group_entity, update its runnable_weight to reflect the new - * h_nr_queued of its group cfs_rq. + * h_nr_runnable of its group cfs_rq. * - For group_entity, update its weight to reflect the new share of * its group cfs_rq * - Add its new weight to cfs_rq->load.weight @@ -5471,18 +5471,21 @@ static void set_delayed(struct sched_entity *se) for_each_sched_entity(se) { struct cfs_rq *cfs_rq =3D cfs_rq_of(se); =20 + cfs_rq->h_nr_runnable--; cfs_rq->h_nr_delayed++; if (cfs_rq_throttled(cfs_rq)) break; } } =20 -static void clear_delayed(struct sched_entity *se) +static void clear_delayed(struct sched_entity *se, bool running) { se->sched_delayed =3D 0; for_each_sched_entity(se) { struct cfs_rq *cfs_rq =3D cfs_rq_of(se); =20 + if (running) + cfs_rq->h_nr_runnable++; cfs_rq->h_nr_delayed--; if (cfs_rq_throttled(cfs_rq)) break; @@ -5491,7 +5494,7 @@ static void clear_delayed(struct sched_entity *se) =20 static inline void finish_delayed_dequeue_entity(struct sched_entity *se) { - clear_delayed(se); + clear_delayed(se, false); if (sched_feat(DELAY_ZERO) && se->vlag > 0) se->vlag =3D 0; } @@ -5534,7 +5537,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) * When dequeuing a sched_entity, we must: * - Update loads to have both entity and cfs_rq synced with now. * - For group_entity, update its runnable_weight to reflect the new - * h_nr_queued of its group cfs_rq. + * h_nr_runnable of its group cfs_rq. * - Subtract its previous weight from cfs_rq->load.weight. * - For group entity, update its weight to reflect the new share * of its group cfs_rq. @@ -5934,7 +5937,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, idle_task_delta, delayed_delta, dequeue =3D 1; + long queued_delta, runnable_delta, idle_task_delta, delayed_delta, dequeu= e =3D 1; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 raw_spin_lock(&cfs_b->lock); @@ -5966,6 +5969,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) rcu_read_unlock(); =20 queued_delta =3D cfs_rq->h_nr_queued; + runnable_delta =3D cfs_rq->h_nr_runnable; idle_task_delta =3D cfs_rq->idle_h_nr_running; delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { @@ -5990,6 +5994,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) idle_task_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued -=3D queued_delta; + qcfs_rq->h_nr_runnable -=3D runnable_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; qcfs_rq->h_nr_delayed -=3D delayed_delta; =20 @@ -6013,6 +6018,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) idle_task_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued -=3D queued_delta; + qcfs_rq->h_nr_runnable -=3D runnable_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; qcfs_rq->h_nr_delayed -=3D delayed_delta; } @@ -6040,7 +6046,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, idle_task_delta, delayed_delta; + long queued_delta, runnable_delta, idle_task_delta, delayed_delta; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 se =3D cfs_rq->tg->se[cpu_of(rq)]; @@ -6075,6 +6081,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) } =20 queued_delta =3D cfs_rq->h_nr_queued; + runnable_delta =3D cfs_rq->h_nr_runnable; idle_task_delta =3D cfs_rq->idle_h_nr_running; delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { @@ -6093,6 +6100,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) idle_task_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued +=3D queued_delta; + qcfs_rq->h_nr_runnable +=3D runnable_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 @@ -6111,6 +6119,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) idle_task_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued +=3D queued_delta; + qcfs_rq->h_nr_runnable +=3D runnable_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 @@ -6966,7 +6975,7 @@ requeue_delayed_entity(struct sched_entity *se) } =20 update_load_avg(cfs_rq, se, 0); - clear_delayed(se); + clear_delayed(se, true); } =20 /* @@ -7030,6 +7039,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) enqueue_entity(cfs_rq, se, flags); slice =3D cfs_rq_min_slice(cfs_rq); =20 + if (!h_nr_delayed) + cfs_rq->h_nr_runnable++; cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; cfs_rq->h_nr_delayed +=3D h_nr_delayed; @@ -7054,6 +7065,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 + if (!h_nr_delayed) + cfs_rq->h_nr_runnable++; cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; cfs_rq->h_nr_delayed +=3D h_nr_delayed; @@ -7144,6 +7157,8 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) break; } =20 + if (!h_nr_delayed) + cfs_rq->h_nr_runnable -=3D h_nr_queued; cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; cfs_rq->h_nr_delayed -=3D h_nr_delayed; @@ -7183,6 +7198,8 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 + if (!h_nr_delayed) + cfs_rq->h_nr_runnable -=3D h_nr_queued; cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; cfs_rq->h_nr_delayed -=3D h_nr_delayed; @@ -10319,7 +10336,7 @@ sched_reduced_capacity(struct rq *rq, struct sched_= domain *sd) * When there is more than 1 task, the group_overloaded case already * takes care of cpu with reduced capacity */ - if (rq->cfs.h_nr_queued !=3D 1) + if (rq->cfs.h_nr_runnable !=3D 1) return false; =20 return check_cpu_capacity(rq, sd); @@ -10354,7 +10371,7 @@ static inline void update_sg_lb_stats(struct lb_env= *env, sgs->group_load +=3D load; sgs->group_util +=3D cpu_util_cfs(i); sgs->group_runnable +=3D cpu_runnable(rq); - sgs->sum_h_nr_running +=3D rq->cfs.h_nr_queued; + sgs->sum_h_nr_running +=3D rq->cfs.h_nr_runnable; =20 nr_running =3D rq->nr_running; sgs->sum_nr_running +=3D nr_running; @@ -10669,7 +10686,7 @@ static inline void update_sg_wakeup_stats(struct sc= hed_domain *sd, sgs->group_util +=3D cpu_util_without(i, p); sgs->group_runnable +=3D cpu_runnable_without(rq, p); local =3D task_running_on_cpu(i, p); - sgs->sum_h_nr_running +=3D rq->cfs.h_nr_queued - local; + sgs->sum_h_nr_running +=3D rq->cfs.h_nr_runnable - local; =20 nr_running =3D rq->nr_running - local; sgs->sum_nr_running +=3D nr_running; @@ -11451,7 +11468,7 @@ static struct rq *sched_balance_find_src_rq(struct = lb_env *env, if (rt > env->fbq_type) continue; =20 - nr_running =3D rq->cfs.h_nr_queued; + nr_running =3D rq->cfs.h_nr_runnable; if (!nr_running) continue; =20 @@ -11610,7 +11627,7 @@ static int need_active_balance(struct lb_env *env) * available on dst_cpu. */ if (env->idle && - (env->src_rq->cfs.h_nr_queued =3D=3D 1)) { + (env->src_rq->cfs.h_nr_runnable =3D=3D 1)) { if ((check_cpu_capacity(env->src_rq, sd)) && (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_= cpu)*100)) return 1; @@ -12353,7 +12370,7 @@ static void nohz_balancer_kick(struct rq *rq) * If there's a runnable CFS task and the current CPU has reduced * capacity, kick the ILB to see if there's a better CPU to run on: */ - if (rq->cfs.h_nr_queued >=3D 1 && check_cpu_capacity(rq, sd)) { + if (rq->cfs.h_nr_runnable >=3D 1 && check_cpu_capacity(rq, sd)) { flags =3D NOHZ_STATS_KICK | NOHZ_BALANCE_KICK; goto unlock; } diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index 2bad0b508dfc..7a8534a2deff 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -275,7 +275,7 @@ ___update_load_avg(struct sched_avg *sa, unsigned long = load) * * group: [ see update_cfs_group() ] * se_weight() =3D tg->weight * grq->load_avg / tg->load_avg - * se_runnable() =3D grq->h_nr_queued + * se_runnable() =3D grq->h_nr_runnable * * runnable_sum =3D se_runnable() * runnable =3D grq->runnable_sum * runnable_avg =3D runnable_sum @@ -321,7 +321,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cf= s_rq) { if (___update_load_sum(now, &cfs_rq->avg, scale_load_down(cfs_rq->load.weight), - cfs_rq->h_nr_queued - cfs_rq->h_nr_delayed, + cfs_rq->h_nr_runnable, cfs_rq->curr !=3D NULL)) { =20 ___update_load_avg(&cfs_rq->avg, 1); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4677e5412c40..e0b05ab43abd 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -646,7 +646,8 @@ struct balance_callback { struct cfs_rq { struct load_weight load; unsigned int nr_running; - unsigned int h_nr_queued; /* SCHED_{NORMAL,BATCH,IDLE} */ + unsigned int h_nr_runnable; /* SCHED_{NORMAL,BATCH,IDLE} */ + unsigned int h_nr_queued; unsigned int idle_nr_running; /* SCHED_IDLE */ unsigned int idle_h_nr_running; /* SCHED_IDLE */ unsigned int h_nr_delayed; @@ -898,11 +899,8 @@ struct dl_rq { =20 static inline void se_update_runnable(struct sched_entity *se) { - if (!entity_is_task(se)) { - struct cfs_rq *cfs_rq =3D se->my_q; - - se->runnable_weight =3D cfs_rq->h_nr_queued - cfs_rq->h_nr_delayed; - } + if (!entity_is_task(se)) + se->runnable_weight =3D se->my_q->h_nr_runnable; } =20 static inline long se_runnable(struct sched_entity *se) --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5617F198E61 for ; Fri, 29 Nov 2024 16:18:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897089; cv=none; b=ABzrxbLxOMjzwbbCMHMGekh29jUiJ8DWdjUq6mkaS8u/E75RePBB9UoZOQoblG+NGOa+mFYOcF1tyrUJwoSrjDdycsSF0vVKRK6Nbf9xngaPOBLRObX0lsepX1geEeL3rDELoLVnQd/e9wyaE9fmN+fmWqkpdGuUBnb2Jx5Wedw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897089; c=relaxed/simple; bh=tqNOtmW96sg8iet4ogIXsIsEvh2i05V9tNvLJtxW64U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XUp0mZHR7Ix4fPZ67HBJTpiOOIXTppybtnlBXtaKV7YEbeI1CKLv+czJRFKfDvfLkVrTu+71V+L7g8e9RoGOEIBe9LhSgHe8LWfNVxMRhx84Z5/uyKDVu7RYPiNOLKaZ0QcDZv8ewD+xXu/cGT3Dpqbdj0MMz/ju1XpY27mtlgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WUKOcADs; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WUKOcADs" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-432d86a3085so17991135e9.2 for ; Fri, 29 Nov 2024 08:18:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897086; x=1733501886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vF2R4EUT+nJZbHQI5DrM5xiVMJG0f4OOkPOReTcBCxU=; b=WUKOcADseB/0bfzbQWAo4zfJP0Q05rFkq3CONuFCNa/GDmK2L587Xq2kqqv8DC8v5o qYKEmPw9SQDLZ7C6R2Gj/4KKcSWIZSIzm2IuBuKHYPNP6e381D5/WRB0FDdf9SeSnxbH +06SH5a5D7/PnQJVr1HGopQJd6i/bV+qSV9YOCaLQrIv7G1eVG+vlTOOWQ0vBn7gbKCv zGZfK1s33VXQpb1rDAci3mKWR4AIhGO3tOeWV0UXHLCI8kCdDcfhiWyZGKo36s2Z6sn4 M+xVFf8SjQlA7tbf1BzKMG9ad0Nj2izh2u4yTMtxI42yiGbnzq0hBu3QKSbIUruQcCnz ie6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897086; x=1733501886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vF2R4EUT+nJZbHQI5DrM5xiVMJG0f4OOkPOReTcBCxU=; b=fdI2pWK+t74zM0SdFAA+IZM2Ap7VsvANSiXpaGzky7wQ6NqwrK7390L1slrH9tahh9 HLB4X+D/HmFF4pEpaUZM2QTFRQS8gU4d32somQWPIvUcMYcQml+70m4pAlflhXGFA/Ja zcFIwtyla48IgTFub/n3OwoOH0t1o+fdseQtmvIa0m+jS8K8OzTBsuuZ5MFyCEgDFZOz 3ZxnBJUDLRcOs9pEhCYy998qDADzbDebV3qgprmsYTwch7inpYHDSXpRFxiB5nkcLGIW 9urQwwsZwCOcQHZfZzr7sZMryep4cbe2syqv0D1Fp4jFuS2SoFTmDWn3FgTVdHanIfPl tcWg== X-Forwarded-Encrypted: i=1; AJvYcCUnHyQMr5j72WHppCI3wT5xr5/W3H2AGm+thTm4dT8HlAuZFborvWyotklwLb7eSQxscNZV26K4rLO3ENk=@vger.kernel.org X-Gm-Message-State: AOJu0YyIj6Iyt9wcQpJki6/Ah3LMrnf/r4fovgDZjT9vuvn7rN1/wCs9 e/U11P+fisZUSTSjQQxZaQTdS8UsKGjvUWBdXJuSg7f0X4GK7bSRRZqsJzXcShE= X-Gm-Gg: ASbGncuvT3HWHR12eSOrIMxBRZuLctjizXiPqhERd8pYwd0C+xvsquaM8oTgCeQ/Pkg HhK0WIPU3hxA+4YX+XC1wVy9B5yzY4bxnmHhtma1BgEvR37f4YmcJIgHfKOfnOadcZKPxrSzVb8 TdJkJiWfVT83Ah4zyGqogX2TfzJPoTBKtS7KgRDbdJD7ZaEvqkpa3lKHyeUSF2YpV6+S/eLU+PA mN9dNjpyxCSLpxTr1H8duOpimJaJj1Q9G1yEgMW2Vizt2MyZwf+iz5QtYg= X-Google-Smtp-Source: AGHT+IFbikcBofclt6kKPgOT/PkUTy9kvil+mRrmrXpD3qGu4K0mEXRYd1TZsK9MI+vZ7Y2naBY8+A== X-Received: by 2002:a05:600c:5012:b0:434:a396:9474 with SMTP id 5b1f17b1804b1-434a9dd0586mr122079975e9.18.1732897085601; Fri, 29 Nov 2024 08:18:05 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:04 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 04/10 v2] sched/fair: Removed unsued cfs_rq.h_nr_delayed Date: Fri, 29 Nov 2024 17:17:50 +0100 Message-ID: <20241129161756.3081386-5-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" h_nr_delayed is not used anymore. We now have - h_nr_runnable which tracks tasks ready to run - h_nr_queued which tracks queued tasks either ready to run or delayed dequeue Signed-off-by: Vincent Guittot --- kernel/sched/debug.c | 1 - kernel/sched/fair.c | 45 ++++++++++++++------------------------------ kernel/sched/sched.h | 1 - 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index fd711cc4d44c..56be3651605d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -846,7 +846,6 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); SEQ_printf(m, " .%-30s: %d\n", "h_nr_runnable", cfs_rq->h_nr_runnable); SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); - SEQ_printf(m, " .%-30s: %d\n", "h_nr_delayed", cfs_rq->h_nr_delayed); SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", cfs_rq->idle_nr_running); SEQ_printf(m, " .%-30s: %d\n", "idle_h_nr_running", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d5736bde3682..c13163deb92c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5472,21 +5472,18 @@ static void set_delayed(struct sched_entity *se) struct cfs_rq *cfs_rq =3D cfs_rq_of(se); =20 cfs_rq->h_nr_runnable--; - cfs_rq->h_nr_delayed++; if (cfs_rq_throttled(cfs_rq)) break; } } =20 -static void clear_delayed(struct sched_entity *se, bool running) +static void clear_delayed(struct sched_entity *se) { se->sched_delayed =3D 0; for_each_sched_entity(se) { struct cfs_rq *cfs_rq =3D cfs_rq_of(se); =20 - if (running) - cfs_rq->h_nr_runnable++; - cfs_rq->h_nr_delayed--; + cfs_rq->h_nr_runnable++; if (cfs_rq_throttled(cfs_rq)) break; } @@ -5494,7 +5491,7 @@ static void clear_delayed(struct sched_entity *se, bo= ol running) =20 static inline void finish_delayed_dequeue_entity(struct sched_entity *se) { - clear_delayed(se, false); + se->sched_delayed =3D 0; if (sched_feat(DELAY_ZERO) && se->vlag > 0) se->vlag =3D 0; } @@ -5937,7 +5934,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, runnable_delta, idle_task_delta, delayed_delta, dequeu= e =3D 1; + long queued_delta, runnable_delta, idle_task_delta, dequeue =3D 1; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 raw_spin_lock(&cfs_b->lock); @@ -5971,7 +5968,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) queued_delta =3D cfs_rq->h_nr_queued; runnable_delta =3D cfs_rq->h_nr_runnable; idle_task_delta =3D cfs_rq->idle_h_nr_running; - delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); int flags; @@ -5996,7 +5992,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->h_nr_runnable -=3D runnable_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; - qcfs_rq->h_nr_delayed -=3D delayed_delta; =20 if (qcfs_rq->load.weight) { /* Avoid re-evaluating load for this entity: */ @@ -6020,7 +6015,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->h_nr_runnable -=3D runnable_delta; qcfs_rq->idle_h_nr_running -=3D idle_task_delta; - qcfs_rq->h_nr_delayed -=3D delayed_delta; } =20 /* At this point se is NULL and we are at root level*/ @@ -6046,7 +6040,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, runnable_delta, idle_task_delta, delayed_delta; + long queued_delta, runnable_delta, idle_task_delta; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 se =3D cfs_rq->tg->se[cpu_of(rq)]; @@ -6083,7 +6077,6 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) queued_delta =3D cfs_rq->h_nr_queued; runnable_delta =3D cfs_rq->h_nr_runnable; idle_task_delta =3D cfs_rq->idle_h_nr_running; - delayed_delta =3D cfs_rq->h_nr_delayed; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); =20 @@ -6102,7 +6095,6 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->h_nr_runnable +=3D runnable_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; - qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6121,7 +6113,6 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->h_nr_runnable +=3D runnable_delta; qcfs_rq->idle_h_nr_running +=3D idle_task_delta; - qcfs_rq->h_nr_delayed +=3D delayed_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6975,7 +6966,7 @@ requeue_delayed_entity(struct sched_entity *se) } =20 update_load_avg(cfs_rq, se, 0); - clear_delayed(se, true); + clear_delayed(se); } =20 /* @@ -6989,7 +6980,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) struct cfs_rq *cfs_rq; struct sched_entity *se =3D &p->se; int idle_h_nr_running =3D task_has_idle_policy(p); - int h_nr_delayed =3D 0; + int h_nr_runnable =3D 0; int task_new =3D !(flags & ENQUEUE_WAKEUP); int rq_h_nr_queued =3D rq->cfs.h_nr_queued; u64 slice =3D 0; @@ -7017,7 +7008,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT); =20 if (task_new) - h_nr_delayed =3D !!se->sched_delayed; + h_nr_runnable =3D !se->sched_delayed; =20 for_each_sched_entity(se) { if (se->on_rq) { @@ -7039,11 +7030,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct = *p, int flags) enqueue_entity(cfs_rq, se, flags); slice =3D cfs_rq_min_slice(cfs_rq); =20 - if (!h_nr_delayed) - cfs_rq->h_nr_runnable++; + cfs_rq->h_nr_runnable +=3D h_nr_runnable; cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; - cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D 1; @@ -7065,11 +7054,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct = *p, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 - if (!h_nr_delayed) - cfs_rq->h_nr_runnable++; + cfs_rq->h_nr_runnable +=3D h_nr_runnable; cfs_rq->h_nr_queued++; cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; - cfs_rq->h_nr_delayed +=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D 1; @@ -7132,7 +7119,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) struct task_struct *p =3D NULL; int idle_h_nr_running =3D 0; int h_nr_queued =3D 0; - int h_nr_delayed =3D 0; + int h_nr_runnable =3D 0; struct cfs_rq *cfs_rq; u64 slice =3D 0; =20 @@ -7141,7 +7128,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) h_nr_queued =3D 1; idle_h_nr_running =3D task_has_idle_policy(p); if (!task_sleep && !task_delayed) - h_nr_delayed =3D !!se->sched_delayed; + h_nr_runnable =3D !se->sched_delayed; } else { cfs_rq =3D group_cfs_rq(se); slice =3D cfs_rq_min_slice(cfs_rq); @@ -7157,11 +7144,9 @@ static int dequeue_entities(struct rq *rq, struct sc= hed_entity *se, int flags) break; } =20 - if (!h_nr_delayed) - cfs_rq->h_nr_runnable -=3D h_nr_queued; + cfs_rq->h_nr_runnable -=3D h_nr_runnable; cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; - cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D h_nr_queued; @@ -7198,11 +7183,9 @@ static int dequeue_entities(struct rq *rq, struct sc= hed_entity *se, int flags) se->slice =3D slice; slice =3D cfs_rq_min_slice(cfs_rq); =20 - if (!h_nr_delayed) - cfs_rq->h_nr_runnable -=3D h_nr_queued; + cfs_rq->h_nr_runnable -=3D h_nr_runnable; cfs_rq->h_nr_queued -=3D h_nr_queued; cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; - cfs_rq->h_nr_delayed -=3D h_nr_delayed; =20 if (cfs_rq_is_idle(cfs_rq)) idle_h_nr_running =3D h_nr_queued; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index e0b05ab43abd..e098b852704a 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -650,7 +650,6 @@ struct cfs_rq { unsigned int h_nr_queued; unsigned int idle_nr_running; /* SCHED_IDLE */ unsigned int idle_h_nr_running; /* SCHED_IDLE */ - unsigned int h_nr_delayed; =20 s64 avg_vruntime; u64 avg_load; --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D35ED19CCEC for ; Fri, 29 Nov 2024 16:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897090; cv=none; b=cCf2VP1QOkCAjmVUXSg4M0e+Fy+3Bik5NR1lTo6R1ZKDCnIKi+9UusPpDZxNyHquZkeht8RlAMKsmy3Sb3sejFy+Az6rPDQv2B8m3uX1IihzfnbikHMT/bkuKrghJME3/zdDRsXpyRGcb5pfv5JMCCLVrzY/kSQ1+p34hxmhsBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897090; c=relaxed/simple; bh=BQroqjA3tpW6ydk5eyvkfeQCSMdsCrBx2gtpZY1Z2ws=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ctYKAwAbt5wKgjDTs/t4eoUpc1nahnb5v30XwdmMqXkDI5GFnGNsTxNz4OhhuOCu1m3DrGsuNUEpWujcctW3/L22kGy1pazBjkyS15vpwqT3xjxIKV2FETFGk2qRdj2KkGKJo1WId1Ei4cyqJ9FE4SoILZN8EO1I5k9qpFjrMh8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rPJfIGIZ; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rPJfIGIZ" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4349e1467fbso18431495e9.1 for ; Fri, 29 Nov 2024 08:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897087; x=1733501887; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CgbHKxsSuKlEzMqZT8dZSeNojQwBTMFn/yeQpPPHhPw=; b=rPJfIGIZqPte52o/OCf6zIEjeFrEPRQYtuqrqbMSaZKQwxqSjbG/eeyGhbjC+F1Z3v IICBK2S+AVfmk7l+m7M5EV/6n/DZtj3o8s9C2oXPDYUHWdUCRpCtoW/NLSBnLS727Edt 905ca7e+jun2BEs/Q0GUF2biJreTUfYeQO9undTi9TfLxPwddhxZ0sqUzmSIopvi6QvL vTs8XsLcTOqPV1edFW7Kip9yBGNQSi1NvxOutxLYm9jMFLR0hNeB1SD41wWG3IgiK6nX GlNpZSntBjISsG6Abo/ZWJzbAq6IWVeDd3BAQ1sAs2FpwmIpXcm743B6LSLYBPi82eHS dI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897087; x=1733501887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CgbHKxsSuKlEzMqZT8dZSeNojQwBTMFn/yeQpPPHhPw=; b=WIRrnMmyb2WgDI8fCTRD6BMWRecX/LsUQoGo7x5RhdJWhsCaqddZqnpNHSWbGOJNag a6zSZSIEoF9CAW8tSLhLb0A9stVucvv5oe2YRR+F3BlYCCVApogtsocgADXDAzsK9+GC 72olprodcaC54oWXT2jpB4o2zoJlgbwYVnimU/KAjdaL1aDJOMAvBAsxKKRK5Ns1InJg XgdodrMmSG//n0IefQQ3vgHbji4P2nyZ6JVxmsq3i3vPHlLAwiQzbO+Tt30rmC6oSKqm QXAJaSHc8kIanx9IlH++3ddKFXeRmgSMig6Pcg53A4bQb5UpCYSZ97eoM5lA14SSU9V1 l+iQ== X-Forwarded-Encrypted: i=1; AJvYcCUjgcmyyIdlpm+2je+YjSwEuC5+wHPqlcV9C6zWSvSXfAhEZrRej6QZ3WBmfgvDaKa7mkybDTkF3/f+t3U=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7n5lzMsz9pU/fDYGn9mb3h+k5uJSn0PguVpK9aB1+vJPYeQjL 6DGpRoZnKW8Oks6BOYXAYgBKotJuSEWEbaXVo+sDP19I9yE5q4a8gGwIQALXqIM= X-Gm-Gg: ASbGncu/3Jj1rY785VWLW3owgubzYh3GCWcSu56y+GX8I7ixDSX7ovZXI31dDt6GMcr v+7wrWxf1xd3qfLh96G1U8kdr83rc2cx26jxWAjDUwclC45gqJQKyV37sRe30JHdJ/7pt28eNav pSRwTWDcZlo5qBN95o5M45go7CJPK5kwjQzHgiQ7x0Nes9aaCFzK7aDCwAqQMcGLq67qK3HU3Wy UQ9oN/T+YDMS1uXRyRGMFzj1jDXdYA+bdHfcOyAwVw2cficTWHBNmOj2ec= X-Google-Smtp-Source: AGHT+IEfsr5441I8R7aL13O7HLv1nVIFu3QDWMcm0ug1ajKBaQVVSBg8AYDKw943gznGxXFbYlowjA== X-Received: by 2002:a5d:588f:0:b0:382:4aeb:91c7 with SMTP id ffacd0b85a97d-385c6eb6911mr11101247f8f.18.1732897087022; Fri, 29 Nov 2024 08:18:07 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:06 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 05/10 v2] sched/fair: Rename cfs_rq.idle_h_nr_running into h_nr_idle Date: Fri, 29 Nov 2024 17:17:51 +0100 Message-ID: <20241129161756.3081386-6-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use same naming convention as others starting with h_nr_* and rename idle_h_nr_running into h_nr_idle. The "running" is not correct anymore as it includes delayed dequeue tasks as well. Signed-off-by: Vincent Guittot --- kernel/sched/debug.c | 4 ++-- kernel/sched/fair.c | 52 ++++++++++++++++++++++---------------------- kernel/sched/sched.h | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 56be3651605d..867e1102c368 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -848,8 +848,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", cfs_rq->idle_nr_running); - SEQ_printf(m, " .%-30s: %d\n", "idle_h_nr_running", - cfs_rq->idle_h_nr_running); + SEQ_printf(m, " .%-30s: %d\n", "h_nr_idle", + cfs_rq->h_nr_idle); SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight); #ifdef CONFIG_SMP SEQ_printf(m, " .%-30s: %lu\n", "load_avg", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c13163deb92c..13ee5ea13580 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5934,7 +5934,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, runnable_delta, idle_task_delta, dequeue =3D 1; + long queued_delta, runnable_delta, idle_delta, dequeue =3D 1; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 raw_spin_lock(&cfs_b->lock); @@ -5967,7 +5967,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) =20 queued_delta =3D cfs_rq->h_nr_queued; runnable_delta =3D cfs_rq->h_nr_runnable; - idle_task_delta =3D cfs_rq->idle_h_nr_running; + idle_delta =3D cfs_rq->h_nr_idle; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); int flags; @@ -5987,11 +5987,11 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) dequeue_entity(qcfs_rq, se, flags); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_queued; + idle_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->h_nr_runnable -=3D runnable_delta; - qcfs_rq->idle_h_nr_running -=3D idle_task_delta; + qcfs_rq->h_nr_idle -=3D idle_delta; =20 if (qcfs_rq->load.weight) { /* Avoid re-evaluating load for this entity: */ @@ -6010,11 +6010,11 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) se_update_runnable(se); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_queued; + idle_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued -=3D queued_delta; qcfs_rq->h_nr_runnable -=3D runnable_delta; - qcfs_rq->idle_h_nr_running -=3D idle_task_delta; + qcfs_rq->h_nr_idle -=3D idle_delta; } =20 /* At this point se is NULL and we are at root level*/ @@ -6040,7 +6040,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq =3D rq_of(cfs_rq); struct cfs_bandwidth *cfs_b =3D tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long queued_delta, runnable_delta, idle_task_delta; + long queued_delta, runnable_delta, idle_delta; long rq_h_nr_queued =3D rq->cfs.h_nr_queued; =20 se =3D cfs_rq->tg->se[cpu_of(rq)]; @@ -6076,7 +6076,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) =20 queued_delta =3D cfs_rq->h_nr_queued; runnable_delta =3D cfs_rq->h_nr_runnable; - idle_task_delta =3D cfs_rq->idle_h_nr_running; + idle_delta =3D cfs_rq->h_nr_idle; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq =3D cfs_rq_of(se); =20 @@ -6090,11 +6090,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) enqueue_entity(qcfs_rq, se, ENQUEUE_WAKEUP); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_queued; + idle_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->h_nr_runnable +=3D runnable_delta; - qcfs_rq->idle_h_nr_running +=3D idle_task_delta; + qcfs_rq->h_nr_idle +=3D idle_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6108,11 +6108,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) se_update_runnable(se); =20 if (cfs_rq_is_idle(group_cfs_rq(se))) - idle_task_delta =3D cfs_rq->h_nr_queued; + idle_delta =3D cfs_rq->h_nr_queued; =20 qcfs_rq->h_nr_queued +=3D queued_delta; qcfs_rq->h_nr_runnable +=3D runnable_delta; - qcfs_rq->idle_h_nr_running +=3D idle_task_delta; + qcfs_rq->h_nr_idle +=3D idle_delta; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(qcfs_rq)) @@ -6927,7 +6927,7 @@ static inline void check_update_overutilized_status(s= truct rq *rq) { } /* Runqueue only has SCHED_IDLE tasks enqueued */ static int sched_idle_rq(struct rq *rq) { - return unlikely(rq->nr_running =3D=3D rq->cfs.idle_h_nr_running && + return unlikely(rq->nr_running =3D=3D rq->cfs.h_nr_idle && rq->nr_running); } =20 @@ -6979,7 +6979,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) { struct cfs_rq *cfs_rq; struct sched_entity *se =3D &p->se; - int idle_h_nr_running =3D task_has_idle_policy(p); + int h_nr_idle =3D task_has_idle_policy(p); int h_nr_runnable =3D 0; int task_new =3D !(flags & ENQUEUE_WAKEUP); int rq_h_nr_queued =3D rq->cfs.h_nr_queued; @@ -7032,10 +7032,10 @@ enqueue_task_fair(struct rq *rq, struct task_struct= *p, int flags) =20 cfs_rq->h_nr_runnable +=3D h_nr_runnable; cfs_rq->h_nr_queued++; - cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; + cfs_rq->h_nr_idle +=3D h_nr_idle; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D 1; + h_nr_idle =3D 1; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) @@ -7056,10 +7056,10 @@ enqueue_task_fair(struct rq *rq, struct task_struct= *p, int flags) =20 cfs_rq->h_nr_runnable +=3D h_nr_runnable; cfs_rq->h_nr_queued++; - cfs_rq->idle_h_nr_running +=3D idle_h_nr_running; + cfs_rq->h_nr_idle +=3D h_nr_idle; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D 1; + h_nr_idle =3D 1; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) @@ -7117,7 +7117,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) bool task_sleep =3D flags & DEQUEUE_SLEEP; bool task_delayed =3D flags & DEQUEUE_DELAYED; struct task_struct *p =3D NULL; - int idle_h_nr_running =3D 0; + int h_nr_idle =3D 0; int h_nr_queued =3D 0; int h_nr_runnable =3D 0; struct cfs_rq *cfs_rq; @@ -7126,7 +7126,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags) if (entity_is_task(se)) { p =3D task_of(se); h_nr_queued =3D 1; - idle_h_nr_running =3D task_has_idle_policy(p); + h_nr_idle =3D task_has_idle_policy(p); if (!task_sleep && !task_delayed) h_nr_runnable =3D !se->sched_delayed; } else { @@ -7146,10 +7146,10 @@ static int dequeue_entities(struct rq *rq, struct s= ched_entity *se, int flags) =20 cfs_rq->h_nr_runnable -=3D h_nr_runnable; cfs_rq->h_nr_queued -=3D h_nr_queued; - cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; + cfs_rq->h_nr_idle -=3D h_nr_idle; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D h_nr_queued; + h_nr_idle =3D h_nr_queued; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) @@ -7185,10 +7185,10 @@ static int dequeue_entities(struct rq *rq, struct s= ched_entity *se, int flags) =20 cfs_rq->h_nr_runnable -=3D h_nr_runnable; cfs_rq->h_nr_queued -=3D h_nr_queued; - cfs_rq->idle_h_nr_running -=3D idle_h_nr_running; + cfs_rq->h_nr_idle -=3D h_nr_idle; =20 if (cfs_rq_is_idle(cfs_rq)) - idle_h_nr_running =3D h_nr_queued; + h_nr_idle =3D h_nr_queued; =20 /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) @@ -13543,7 +13543,7 @@ int sched_group_set_idle(struct task_group *tg, lon= g idle) } =20 idle_task_delta =3D grp_cfs_rq->h_nr_queued - - grp_cfs_rq->idle_h_nr_running; + grp_cfs_rq->h_nr_idle; if (!cfs_rq_is_idle(grp_cfs_rq)) idle_task_delta *=3D -1; =20 @@ -13553,7 +13553,7 @@ int sched_group_set_idle(struct task_group *tg, lon= g idle) if (!se->on_rq) break; =20 - cfs_rq->idle_h_nr_running +=3D idle_task_delta; + cfs_rq->h_nr_idle +=3D idle_task_delta; =20 /* Already accounted at parent level and above. */ if (cfs_rq_is_idle(cfs_rq)) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index e098b852704a..8c57da1af378 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -649,7 +649,7 @@ struct cfs_rq { unsigned int h_nr_runnable; /* SCHED_{NORMAL,BATCH,IDLE} */ unsigned int h_nr_queued; unsigned int idle_nr_running; /* SCHED_IDLE */ - unsigned int idle_h_nr_running; /* SCHED_IDLE */ + unsigned int h_nr_idle; /* SCHED_IDLE */ =20 s64 avg_vruntime; u64 avg_load; --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81B3F19F131 for ; Fri, 29 Nov 2024 16:18:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897093; cv=none; b=uiGef679qY6Z6yd/XC8g1Wmdh4ZeQxFWzbjyKA6jJZSH+A75oGDlm7aUM9tr1jUIYMfK7GxcVVg3b25y8r7v4rO5CRLi9wqaC1kNGTMsdqlVNPOGIgo0xku0+/2cXPU1jIRlqMsTtUmffDFpLhMcG78g02chhl0ALc7SGNGjXF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897093; c=relaxed/simple; bh=GxgIChr+Nt7Mc/eCvRx7iCX/prRRYopji8rvDm6A3Hs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UGoXwcN5HGxefryirRIop8cvvzyxvuI9fJuj9N2D2h3i8OHWeZXZ2gwoY/yblcxoE3GPrV9iYbMTvcd28V7ym11c8fx+9acBK8MTE/ja0nRfHIkA3wV3PBcvrJ5HWQvRCnKg9WPy/ryeInFlR8uQDgbfbhrZX6xklME7RmCpOW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lz5uOfVF; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lz5uOfVF" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-434acf1f9abso18611145e9.2 for ; Fri, 29 Nov 2024 08:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897089; x=1733501889; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Whd635DH52K+eo3lEmn9yMLzsCrUc6kKdp70v1HMEuM=; b=lz5uOfVFKYEFc5SgjjZR5jPB82nP6fHYoQe285ueLSYmp+55XLuFPMLk44c5oWBD5D J9q+4Zqto8yt7JNiyV/V0i07iC1w2upWmlsyvYqhg2DeWgue6ZnoqFbi1+jNKLFVTYcR pVl5SHxIyadC2WlBpj7PzBFDEYE92HEvvGBuchtG8Gl7qOULfV0Owh1TDDw1PTKjo1tf ytAjLdLM2wHPyYZ/+ZFjW2Scbnd2DU5Oza6wBUY1fy86XIsSGIfwZ63jereBhbwZEiMq wUzaswXKP3YJHUj/VN+zG/GLkvypl/F/UCKtiKKr0y2LfeU7SpIDh+s6sb13V1rF9Ap6 +loQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897089; x=1733501889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Whd635DH52K+eo3lEmn9yMLzsCrUc6kKdp70v1HMEuM=; b=ZVZ2qrIw9BuBzRJETNivwiMuMRsln3a61q4wJFnahASN9mUi3esSh3zy1wcDRDLSwb xKfgNm2+mMN6BjW7/gIMFpV12+74VOOvX9DSu+2tweTIz2aT31zLupMqgBu+QgjFk0N4 an1RMDZ5djp0CGC25YalqovYkgohk9XCFxC0xc2g/OZmDwmK1/IHXy8m14eY60DwfKBG KpbM+0NZGRdeMLttA0Azphj6q3esEgPt6b8GYJPEt1/+us9VDI1ljEkXBvdjAsxlfLvt JC6OvnukCYEsRu/4V63Ftju0yHgR/ZQdtzEQRznht+msLDcN9T4GPa2SBXH1+1grHvlk lluQ== X-Forwarded-Encrypted: i=1; AJvYcCXspTT481Rs/7JRZlRVjpC4XWWR0n4I6zI5bLyeLZU/j+lc7e/YHQjHRzQHOrcFhBySgoqUC99Tb1SpwiM=@vger.kernel.org X-Gm-Message-State: AOJu0YzIDs5epmyb1lAk4tBj3o1Wwu6rml1NSgxEg7IvOab8MbPmymFe IDlrXOBslc1cvVLDSDksE/GycRIOAB2RP3JZ+FQxcmNHQeBZDRaC48BNg25WSB0= X-Gm-Gg: ASbGncuFQ9c5LQQ+OQKxXERThx/8ReNAktziAirdM0NsULamQoMd/cxm3Mn/ExQz8Vz pqq2rGkZV2nmu/YT5W2RZCeP3f9JIpjfGDVZG0+HzeeAw693GXYiQNcJVZ7uUMxU3Vw3DE4eLmO YOICSJXfz0G3/HYHYvKegiWKXgjgEyFTWrQnffF6FU7XBNckukw1BbRCESrOTBulsTodI7rCYHJ wCXBX3UfpeYzBu9S4jcrsVSE5IT0S+MuUflwrPK59CT83Y+HM3cb4Vj4JY= X-Google-Smtp-Source: AGHT+IFMV7qexSnBmBTl4lE96+HsE0KqpVUywGql5ajgJ8V5+3EbY8LbrGgsTuVTp7HHOvacf6D74A== X-Received: by 2002:a05:600c:4f07:b0:431:52da:9d67 with SMTP id 5b1f17b1804b1-434a9dbbfbbmr128217665e9.3.1732897088805; Fri, 29 Nov 2024 08:18:08 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:07 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 06/10 v2] sched/fair: Remove unused cfs_rq.idle_nr_running Date: Fri, 29 Nov 2024 17:17:52 +0100 Message-ID: <20241129161756.3081386-7-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" cfs_rq.idle_nr_running field is not used anywhere so we can remove the useless associated computation Signed-off-by: Vincent Guittot --- kernel/sched/debug.c | 2 -- kernel/sched/fair.c | 14 +------------- kernel/sched/sched.h | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 867e1102c368..37ccba0bedf5 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -846,8 +846,6 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); SEQ_printf(m, " .%-30s: %d\n", "h_nr_runnable", cfs_rq->h_nr_runnable); SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); - SEQ_printf(m, " .%-30s: %d\n", "idle_nr_running", - cfs_rq->idle_nr_running); SEQ_printf(m, " .%-30s: %d\n", "h_nr_idle", cfs_rq->h_nr_idle); SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 13ee5ea13580..20fe55e95882 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3674,8 +3674,6 @@ account_entity_enqueue(struct cfs_rq *cfs_rq, struct = sched_entity *se) } #endif cfs_rq->nr_running++; - if (se_is_idle(se)) - cfs_rq->idle_nr_running++; } =20 static void @@ -3689,8 +3687,6 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct = sched_entity *se) } #endif cfs_rq->nr_running--; - if (se_is_idle(se)) - cfs_rq->idle_nr_running--; } =20 /* @@ -13523,7 +13519,7 @@ int sched_group_set_idle(struct task_group *tg, lon= g idle) for_each_possible_cpu(i) { struct rq *rq =3D cpu_rq(i); struct sched_entity *se =3D tg->se[i]; - struct cfs_rq *parent_cfs_rq, *grp_cfs_rq =3D tg->cfs_rq[i]; + struct cfs_rq *grp_cfs_rq =3D tg->cfs_rq[i]; bool was_idle =3D cfs_rq_is_idle(grp_cfs_rq); long idle_task_delta; struct rq_flags rf; @@ -13534,14 +13530,6 @@ int sched_group_set_idle(struct task_group *tg, lo= ng idle) if (WARN_ON_ONCE(was_idle =3D=3D cfs_rq_is_idle(grp_cfs_rq))) goto next_cpu; =20 - if (se->on_rq) { - parent_cfs_rq =3D cfs_rq_of(se); - if (cfs_rq_is_idle(grp_cfs_rq)) - parent_cfs_rq->idle_nr_running++; - else - parent_cfs_rq->idle_nr_running--; - } - idle_task_delta =3D grp_cfs_rq->h_nr_queued - grp_cfs_rq->h_nr_idle; if (!cfs_rq_is_idle(grp_cfs_rq)) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 8c57da1af378..7ece69b0fc14 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -648,7 +648,6 @@ struct cfs_rq { unsigned int nr_running; unsigned int h_nr_runnable; /* SCHED_{NORMAL,BATCH,IDLE} */ unsigned int h_nr_queued; - unsigned int idle_nr_running; /* SCHED_IDLE */ unsigned int h_nr_idle; /* SCHED_IDLE */ =20 s64 avg_vruntime; --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5F5819F133 for ; Fri, 29 Nov 2024 16:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897093; cv=none; b=WLyMeglN9xhXNKzZROBgbd+0OX7ay7WBrEFI1oSmnsZIbW6v2Xi1j7EXV7XV/Qw/9GKHlsJY4ACtQ5xFFkznWqwDNLEwnKQ4yMEFP1LvOaTrv0Nd4erjtDreSpb9Q0E3h6RevucW/1HA8msDeP8O++Be9UNiU39MhBWin7d7omg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897093; c=relaxed/simple; bh=XPB2fPFZjrYL0iRHIlVMkQZX1c/Zh2qF3tGKVnuj2uQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S2YTTC1/4XQCtqcdhH4nRpcV7oiagH9wxgAmask9CDbo62unlIYrHT/B1V2FIGRXdZC48q9kLp9YmzPOc5WfEyq7ez0KEX6fJ00r5Qzoet469ZLckVoxGnFixu/9WBgdGG3upMnneaz+BnpC7FbLNUoOwR3sV4DAZrUHsZM8F7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Fa+tclBT; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Fa+tclBT" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-434a8b94fb5so12802525e9.0 for ; Fri, 29 Nov 2024 08:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897090; x=1733501890; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jSJbyVhu/Z0dv4o62YeLYD1I2J6cBWYBkDMBY0s8v6A=; b=Fa+tclBTTIXn8Au0KaZYxSOUv/HMPCkKSNu9lg040a9cm5zIfGno/DFM63pXMIi248 kwhIk++MUX0UqGqaHIlv802cvX/d4g1R7LnAQZNbgl8n6pkqomVjIxvM5r+s5IVA1oRm GUXBEmuFd2ZoU9yuiaKT5k6YpiaPzoLwSaN+z6bthnQCM0OobzTs3gVrKAhzvIgxRzqe l6aj+/YSRQBdnsnnHGrMZGjpdKdRfEmlXFIjm4Nu7v7GpOl607MONdCAar5xZHZHB6iC /lpfRf9GXpGEd+wGyfgqg45YYSKzR1hsw1LbVQnP/06By+hpJJ7CiP6FEMlsZgZeGmRj um4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897090; x=1733501890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jSJbyVhu/Z0dv4o62YeLYD1I2J6cBWYBkDMBY0s8v6A=; b=JIiyi8Fz14E/2bEB+9tK5ojan62OHtb954PYEVvscWZseI2N5hmZKUVyxY0R1A5wde U+DkOrwURMpNKOvdQbCp7kvQ1uLfymNLYM2svanG3cj/Wh/MHOuAnyL3OGSU8K5aiIjB U00iQ4RQK+ER/6yzZluEVLFrxiD1TdYZCbrxvGBjdkbv3a/37juYXPysmuizInTJTh/v 8WqyiQwezHZGHloSWrZFJZzUUk8G8Q1Ps6Z8QdW0X/9Te6r6QwvW4ZnQnjVU1pQk0STh dY4Lw9aTut7VxN1kNAko78f4DiwdgKpPsmWv6CjbOozPgar3hxlrfDlcQ8dZRgWzeKsk O0Kw== X-Forwarded-Encrypted: i=1; AJvYcCXZtjcSxwaoWUKPC0JMuClOEtDaN+Kq+YWwfdTnyhJq80mMFIK7GvSD/2h12LWkptDYEn/Bx4VSYAiQ5Xc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6QGb3lJS00gCaYdufzXDnQ0Pminc8d1/IMUbaPGQ3GpHO+I+y SASzHS66bGR43qwfScTSeVNwNWLkhXFUnS6t/YFYRhSOg61rv4fiOUwoNR+6xQw= X-Gm-Gg: ASbGncsuMhIPPnWP1G4SBbF6rvrZMZfWyKTF8TWCvAXY3eqTvkBOhU9CxhboQw/eywo lj2khMBAHitr0X3ULHpKTdG2HJKw+zMf2C7YGJFHbKrS1mlNptYjpzB2CHzxT19E5SE9ngpwi3N 6KWCBvLCPFQUW0H3bRba+dgokEd7fQWxyodV9HMcvotgXs2WyrNi/z5FjCJhrsDnEcdRyt7wyTG lFwnmmP9o9FqaJgkoZrpMqUUUe+nJVcFyei5NoC7M4clNQqrHHW3Z/vLUE= X-Google-Smtp-Source: AGHT+IE28h3RcxLud9HeNMb47BPU6pdOukpyLe9pUiBwUJVRSJ7AERs4zS2fF6JmhLiCSYGQCAa5pA== X-Received: by 2002:a05:600c:3589:b0:434:a4d3:31f0 with SMTP id 5b1f17b1804b1-434afb9533fmr76784415e9.3.1732897090073; Fri, 29 Nov 2024 08:18:10 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:09 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 07/10 v2] sched/fair: Rename cfs_rq.nr_running into nr_queued Date: Fri, 29 Nov 2024 17:17:53 +0100 Message-ID: <20241129161756.3081386-8-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename cfs_rq.nr_running into cfs_rq.nr_queued which better reflects the reality as the value includes both the ready to run entity and the delayed dequeue entity. Signed-off-by: Vincent Guittot --- kernel/sched/core.c | 2 +- kernel/sched/debug.c | 2 +- kernel/sched/fair.c | 38 +++++++++++++++++++------------------- kernel/sched/sched.h | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ba5e314eb99b..3571f91d4b0d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1341,7 +1341,7 @@ bool sched_can_stop_tick(struct rq *rq) if (scx_enabled() && !scx_can_stop_tick(rq)) return false; =20 - if (rq->cfs.nr_running > 1) + if (rq->cfs.nr_queued > 1) return false; =20 /* diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 37ccba0bedf5..9d9b6940687f 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -843,7 +843,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SPLIT_NS(right_vruntime)); spread =3D right_vruntime - left_vruntime; SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread", SPLIT_NS(spread)); - SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running); + SEQ_printf(m, " .%-30s: %d\n", "nr_queued", cfs_rq->nr_queued); SEQ_printf(m, " .%-30s: %d\n", "h_nr_runnable", cfs_rq->h_nr_runnable); SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued); SEQ_printf(m, " .%-30s: %d\n", "h_nr_idle", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 20fe55e95882..dc9725da033e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -915,7 +915,7 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *c= fs_rq) * We can safely skip eligibility check if there is only one entity * in this cfs_rq, saving some cycles. */ - if (cfs_rq->nr_running =3D=3D 1) + if (cfs_rq->nr_queued =3D=3D 1) return curr && curr->on_rq ? curr : se; =20 if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr))) @@ -1247,7 +1247,7 @@ static void update_curr(struct cfs_rq *cfs_rq) =20 account_cfs_rq_runtime(cfs_rq, delta_exec); =20 - if (cfs_rq->nr_running =3D=3D 1) + if (cfs_rq->nr_queued =3D=3D 1) return; =20 if (resched || did_preempt_short(cfs_rq, curr)) { @@ -3673,7 +3673,7 @@ account_entity_enqueue(struct cfs_rq *cfs_rq, struct = sched_entity *se) list_add(&se->group_node, &rq->cfs_tasks); } #endif - cfs_rq->nr_running++; + cfs_rq->nr_queued++; } =20 static void @@ -3686,7 +3686,7 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct = sched_entity *se) list_del_init(&se->group_node); } #endif - cfs_rq->nr_running--; + cfs_rq->nr_queued--; } =20 /* @@ -5220,7 +5220,7 @@ static inline void update_misfit_status(struct task_s= truct *p, struct rq *rq) =20 static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) { - return !cfs_rq->nr_running; + return !cfs_rq->nr_queued; } =20 #define UPDATE_TG 0x0 @@ -5276,7 +5276,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_enti= ty *se, int flags) * * EEVDF: placement strategy #1 / #2 */ - if (sched_feat(PLACE_LAG) && cfs_rq->nr_running && se->vlag) { + if (sched_feat(PLACE_LAG) && cfs_rq->nr_queued && se->vlag) { struct sched_entity *curr =3D cfs_rq->curr; unsigned long load; =20 @@ -5425,7 +5425,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) __enqueue_entity(cfs_rq, se); se->on_rq =3D 1; =20 - if (cfs_rq->nr_running =3D=3D 1) { + if (cfs_rq->nr_queued =3D=3D 1) { check_enqueue_throttle(cfs_rq); if (!throttled_hierarchy(cfs_rq)) { list_add_leaf_cfs_rq(cfs_rq); @@ -5570,7 +5570,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_en= tity *se, int flags) if (flags & DEQUEUE_DELAYED) finish_delayed_dequeue_entity(se); =20 - if (cfs_rq->nr_running =3D=3D 0) + if (cfs_rq->nr_queued =3D=3D 0) update_idle_cfs_rq_clock_pelt(cfs_rq); =20 return true; @@ -5917,7 +5917,7 @@ static int tg_throttle_down(struct task_group *tg, vo= id *data) list_del_leaf_cfs_rq(cfs_rq); =20 SCHED_WARN_ON(cfs_rq->throttled_clock_self); - if (cfs_rq->nr_running) + if (cfs_rq->nr_queued) cfs_rq->throttled_clock_self =3D rq_clock(rq); } cfs_rq->throttle_count++; @@ -6026,7 +6026,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) */ cfs_rq->throttled =3D 1; SCHED_WARN_ON(cfs_rq->throttled_clock); - if (cfs_rq->nr_running) + if (cfs_rq->nr_queued) cfs_rq->throttled_clock =3D rq_clock(rq); return true; } @@ -6126,7 +6126,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) assert_list_leaf_cfs_rq(rq); =20 /* Determine whether we need to wake up potentially idle CPU: */ - if (rq->curr =3D=3D rq->idle && rq->cfs.nr_running) + if (rq->curr =3D=3D rq->idle && rq->cfs.nr_queued) resched_curr(rq); } =20 @@ -6427,7 +6427,7 @@ static __always_inline void return_cfs_rq_runtime(str= uct cfs_rq *cfs_rq) if (!cfs_bandwidth_used()) return; =20 - if (!cfs_rq->runtime_enabled || cfs_rq->nr_running) + if (!cfs_rq->runtime_enabled || cfs_rq->nr_queued) return; =20 __return_cfs_rq_runtime(cfs_rq); @@ -6950,14 +6950,14 @@ requeue_delayed_entity(struct sched_entity *se) if (sched_feat(DELAY_ZERO)) { update_entity_lag(cfs_rq, se); if (se->vlag > 0) { - cfs_rq->nr_running--; + cfs_rq->nr_queued--; if (se !=3D cfs_rq->curr) __dequeue_entity(cfs_rq, se); se->vlag =3D 0; place_entity(cfs_rq, se, 0); if (se !=3D cfs_rq->curr) __enqueue_entity(cfs_rq, se); - cfs_rq->nr_running++; + cfs_rq->nr_queued++; } } =20 @@ -8876,7 +8876,7 @@ static struct task_struct *pick_task_fair(struct rq *= rq) =20 again: cfs_rq =3D &rq->cfs; - if (!cfs_rq->nr_running) + if (!cfs_rq->nr_queued) return NULL; =20 do { @@ -8993,7 +8993,7 @@ static struct task_struct *__pick_next_task_fair(stru= ct rq *rq, struct task_stru =20 static bool fair_server_has_tasks(struct sched_dl_entity *dl_se) { - return !!dl_se->rq->cfs.nr_running; + return !!dl_se->rq->cfs.nr_queued; } =20 static struct task_struct *fair_server_pick_task(struct sched_dl_entity *d= l_se) @@ -9783,7 +9783,7 @@ static bool __update_blocked_fair(struct rq *rq, bool= *done) if (update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq)) { update_tg_load_avg(cfs_rq); =20 - if (cfs_rq->nr_running =3D=3D 0) + if (cfs_rq->nr_queued =3D=3D 0) update_idle_cfs_rq_clock_pelt(cfs_rq); =20 if (cfs_rq =3D=3D &rq->cfs) @@ -12965,7 +12965,7 @@ static inline void task_tick_core(struct rq *rq, st= ruct task_struct *curr) * MIN_NR_TASKS_DURING_FORCEIDLE - 1 tasks and use that to check * if we need to give up the CPU. */ - if (rq->core->core_forceidle_count && rq->cfs.nr_running =3D=3D 1 && + if (rq->core->core_forceidle_count && rq->cfs.nr_queued =3D=3D 1 && __entity_slice_used(&curr->se, MIN_NR_TASKS_DURING_FORCEIDLE)) resched_curr(rq); } @@ -13109,7 +13109,7 @@ prio_changed_fair(struct rq *rq, struct task_struct= *p, int oldprio) if (!task_on_rq_queued(p)) return; =20 - if (rq->cfs.nr_running =3D=3D 1) + if (rq->cfs.nr_queued =3D=3D 1) return; =20 /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7ece69b0fc14..fa317662da53 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -645,7 +645,7 @@ struct balance_callback { /* CFS-related fields in a runqueue */ struct cfs_rq { struct load_weight load; - unsigned int nr_running; + unsigned int nr_queued; unsigned int h_nr_runnable; /* SCHED_{NORMAL,BATCH,IDLE} */ unsigned int h_nr_queued; unsigned int h_nr_idle; /* SCHED_IDLE */ @@ -2564,7 +2564,7 @@ static inline bool sched_rt_runnable(struct rq *rq) =20 static inline bool sched_fair_runnable(struct rq *rq) { - return rq->cfs.nr_running > 0; + return rq->cfs.nr_queued > 0; } =20 extern struct task_struct *pick_next_task_fair(struct rq *rq, struct task_= struct *prev, struct rq_flags *rf); --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EC8A14C5B3 for ; Fri, 29 Nov 2024 16:18:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897095; cv=none; b=UNEXMek32wWH4C9q6C8RuiGd2Opxe+6Dev9jYiK8LJYhSS50wUWrctYAl1LORL184SYpKDvhs1Cke3Q68VbauBSFceuwPja069AkbL7IA3ZHP0ORX5DBFUM8H/TgaYs3FzNOYqvfVuUrje30/ayI2HnUxDuKcyv/5nkfITPhbi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897095; c=relaxed/simple; bh=5rNF5amaXsZJixky76H/H2BwtSuseNAmI2pbT9MZjJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SZvB3zyg58uwqyV2rvpAao4XzWmkTCdGUP2S6yu0LbonVZ2KG+RE0swBrKAbqYrsD1vpJsoPmkzaq4YPx/rdExiR2HDnZWuHF/LQ2s0TyuGaZ25VH7pQm3iUxh63hM8x9IXn0qMZdBbjH6Ds84F9N+usbG9R5pwrGxulkfYjqfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=c/7iZylA; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c/7iZylA" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-434a95095efso18883715e9.0 for ; Fri, 29 Nov 2024 08:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897091; x=1733501891; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AN6dmWzMShhnYdCqEKnF32ypM7coFrozhxpDR6Xd+e8=; b=c/7iZylAxOGB8m4kypbHZaucwV6hSUEwcxV09Nx+F3rvQSI3PZzcnwwU7PYVfke6Ha BGhHrG2r2EHYRCWurw0Uf++fu9d2QD0ELxHLeCHNyqZxxxZWtoJhTkwSp5UB2LNk0csS PHDxcOm7YzNytb9Yv74uz0bs/otoDV4megEtT4JBvq/jaYVJfEmIZ8cHnlpD6FtoFv// 13NrRPZqKHCXaEoztORRCCqmlQme3nbR5ZDqebqp5vbrJceaob7NIEwawo6NVtpWdNil BOXdTxYYz3Kstxs8Y1R0HNf/bWe7DOmshmijzoFKBCUB9pNiJGxEGpKPr/7a9qiX6oED ducg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897091; x=1733501891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AN6dmWzMShhnYdCqEKnF32ypM7coFrozhxpDR6Xd+e8=; b=LA+KCmeLW0RPmjw9PSSAHDy83VSGCYlHI/fddz3rf5HXucELtt3fT4dlq6CGz3kOG6 kPligrEaBX5dBQ1VTLtFcOe1kRSWk1pLCENVLb20hPka7XE7TgE1sKNE/seEnM67BYol cGQ7c0ukSxU4s8eu8HwlzbE5vIQWnDdW+Y+cw7faLp1t8KSJeM1yboyv3Tl6yPjx754p ejz3KSEVdQQH0Khzz9HPEhLVnu+gc6lo08DNNb3ayC4OgrY8K/cI4NIm0481DLeV0oDR 4XYEahIP5zt7R04Rk4zOHnAI6lCBnhOTF7ynQqq2o/rp2M6r3svqKQhNK5xemG3Z8Up2 9XOQ== X-Forwarded-Encrypted: i=1; AJvYcCWCOVMyM8BLlHO6fhJmuNhMyoC1RszIUCDHwYw++dh0fjcuNsTRImYBCepuhiIMOz7MJpCDNjqpURt8+W0=@vger.kernel.org X-Gm-Message-State: AOJu0YxsIu5PjTCIAu/+dT5M0CFNGYeve1I7fOWsbq9rF4sLwPUJ3oho Vgp/FMULztjvrmDnN8gGF2/JOlAcUAz7GJCkhYnZ6Ddss+R4JmzbjsMF/PbsUhU= X-Gm-Gg: ASbGncuv5r8YJNQZfXNaMzJ+9UqGDdZuwktxcZ46bz94bbbeZHNdoFxYreCQNBXzsXs +9et1rsGh2LWTeXusL3yfkACPGunfPiHS1eh6TpQFB2/f8A6EYx32xWZ6CjdHaR1VN9IvTJBlim Oj5vCqKvjPBThZ9KYmYOdoP8qXawCpfS/7sr/l8hMxYMxiFkHToJwUTtBqIJhfJeSkozougMM/K 6/DvHsq0GHgJks4XiN5RGo4JG51ZBETNhJSfB7Msjm80Bj8jC3NOGOVVIo= X-Google-Smtp-Source: AGHT+IF+IgST8Rc7khbCImbAalx4frVnCVVtZPqXFkY6q1FgR2UiUzP7sUgtq8Ym41RAsjH/TYqsOw== X-Received: by 2002:a05:600c:4fcc:b0:42c:b67b:816b with SMTP id 5b1f17b1804b1-434afb8dea4mr76735565e9.1.1732897091586; Fri, 29 Nov 2024 08:18:11 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:10 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 08/10 v2] sched/fair: Do not try to migrate delayed dequeue task Date: Fri, 29 Nov 2024 17:17:54 +0100 Message-ID: <20241129161756.3081386-9-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Migrating a delayed dequeued task doesn't help in balancing the number of runnable tasks in the system. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dc9725da033e..c34874203da2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9394,11 +9394,15 @@ int can_migrate_task(struct task_struct *p, struct = lb_env *env) =20 /* * We do not migrate tasks that are: - * 1) throttled_lb_pair, or - * 2) cannot be migrated to this CPU due to cpus_ptr, or - * 3) running (obviously), or - * 4) are cache-hot on their current CPU. + * 1) delayed dequeued unless we migrate load, or + * 2) throttled_lb_pair, or + * 3) cannot be migrated to this CPU due to cpus_ptr, or + * 4) running (obviously), or + * 5) are cache-hot on their current CPU. */ + if ((p->se.sched_delayed) && (env->migration_type !=3D migrate_load)) + return 0; + if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu)) return 0; =20 --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A921A0B13 for ; Fri, 29 Nov 2024 16:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897096; cv=none; b=SmmfDu0sTV/2RlrzVnbdp/fYfjtMo+zPHxvjMBBjh89fKiuMZOGuVNJCs6Q8ioYHWsN6XH06jkfttzs2UsLOFeNS9n3hwa+0AfB5xBjlN6XL9qychnU0XS8BncpjPxhM2I3ifa18fLX4mxDfYpgMpsY/FWNt6o6T/Yf97IJ0T6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897096; c=relaxed/simple; bh=2L3jtpLBWH0l2P8fF1Ud91ho1zHZU8g440Ir3CBglIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d+4hNEHknKy9IJU5YNLjIVrPKtzvujrwOwy+ifRQncR4kP+UX2Stm761OSQO90v8t/ZrpRo92BXkWeyQJctU638O4/JqLmIJO7/jQ67ZR4K7Bq2ZcaXIIPpWsUo2TovtJ3ylth19+EfaCBCAOQhE97WQNk8XKS7taAbA4XMsPoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lWypiMfQ; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lWypiMfQ" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-434a8b94fb5so12802865e9.0 for ; Fri, 29 Nov 2024 08:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897093; x=1733501893; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bt0xGTxs8yGFD5cf7awbpbZkl9MBcuva2OpmOmzmwhc=; b=lWypiMfQKzFo9GuP11PoWs+idFuP7uPw8gievlY2TWFWOZTC6NkEisl0JqWa7NCbjV Imwq8rBtxDclwwAEdaAb8ZedSP5HhQHAxf5ONyGLHjJ9IES0RpC+XNxMmhr7KLroGo84 J9O1gcSO/gABohE0OYSQqtzHvA/xeI9as+JxsPmvpl5Lx+OPsOsZ+u475Tu1VBMTV7+l saIQZY2v4OZEtbdrUVjUIioB/BuU5WjYc1RNKEAdZxrRWIdkiB3N4zNUSmAFcbw6Zalh mpu3ruMjiTj8Ht+WaLq+U+wMvhIsxGyfmji/acL0ev7LPeeYI9jjypn1n6zVvGjku3UG /aIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897093; x=1733501893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bt0xGTxs8yGFD5cf7awbpbZkl9MBcuva2OpmOmzmwhc=; b=Hi0ZxISAba8/0gS3AFF//AfZKqQyEHFD4NCtvDX0MjHjLfgbKGyn+HYHj4ZojOeGYQ 3fPA29HDJbW5lzOlEt8BNDwepfyQFr+ItDcCLOAGblcbx5tiAcK5Yv407tekYGfWIS9b PBDPoDE7M3yX7PSP3JNqG0nC0zTQYwRJGuLgi5r6ecU7GSw/xDBV88DVTxAUBv1DREfU 2UMj6ejX2POUDrYl/k2kxuVV1UwcQmxBTbirAMcenIG1ahWGv+o5d2/SnyuhCSKBVsH2 2I/9qZZ+wGHPIoRUiNy7dJ89bpybiKVuRTW1f4wxe6yW22n6jPXC91dDgZm/EbmCeTgC VTjQ== X-Forwarded-Encrypted: i=1; AJvYcCXEPx8P2q/it68q9HrlchiYI1f29TK6SowOfFA1n8YKZ9RjAazBkpmZ1peH0MtfdLw2lrlUfZqSmoEXUKQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywn8/Kbn+SCH2l6OSsSyno10hHzLIvYH3VhXwj4MCu+AMwxWe0A xz/WmVpBVDlV8+z6sV3hUbj0WQvU7dAK5+tQMac0PIRhOHUyx+E1g9ohLp2QMTc= X-Gm-Gg: ASbGnctGomqBimenwxudsM1mKDydShLbxO+Rn9t52bLVY5N9DcWr7+oadDaRdt+B6LL fXudP/TfckpZzANYfi48oexQnCZAP20DymL6lp90ugNIuTzeU+5r4/r9GwCa4NXAHSkbE3Ds4Xt 2K6dYUsaiWmDLmfHZnTDz3FBja3G2GsiY5beTontSy4jsSt/McC8jQGX+3dJLYWnh2/9ySaSUMA uvk+u8Ot5l1R5XZg+CmNHEOI/DgubDJruuqD8FfZSb7GbgDjHMR/1J7N20= X-Google-Smtp-Source: AGHT+IFkZM0c9SimgPiTFNwzQREG6A3LmuZxD0DaX6XGbSX1og3VFsEOdO90EWGOxbv70Cs6YJUgmg== X-Received: by 2002:a05:600c:34ca:b0:431:9340:77e0 with SMTP id 5b1f17b1804b1-434afbb0f4dmr71514855e9.9.1732897092945; Fri, 29 Nov 2024 08:18:12 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:12 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 09/10 v2] sched/fair: Fix sched_can_stop_tick() for fair tasks Date: Fri, 29 Nov 2024 17:17:55 +0100 Message-ID: <20241129161756.3081386-10-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We can't stop the tick of a rq if there are at least 2 tasks enqueued in the whole hierarchy and not only at the root cfs rq. rq->cfs.nr_queued tracks the number of sched_entity at one level whereas rq->cfs.h_nr_enqueued tracks all enqueued tasks in the hierarchy. Signed-off-by: Vincent Guittot --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3571f91d4b0d..866a1605656c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1341,7 +1341,7 @@ bool sched_can_stop_tick(struct rq *rq) if (scx_enabled() && !scx_can_stop_tick(rq)) return false; =20 - if (rq->cfs.nr_queued > 1) + if (rq->cfs.h_nr_queued > 1) return false; =20 /* --=20 2.43.0 From nobody Fri Dec 27 01:20:44 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 811D11A257C for ; Fri, 29 Nov 2024 16:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897098; cv=none; b=kDax8yEZcdkSUvtl3+Ffdr+MvIabq3gf7AWevFECDg/cFXeatZzstvQaeiCZ6G2NwX4KhacxZh7ELUlXSKaA1fk+aDu2C1evfgfHrlwWIRx8gsY4D97jsikoIDjvB5AIFQX6E7Owyyzkst3TXaUUuoA/9iskQGVCQ7/4lm5P6Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732897098; c=relaxed/simple; bh=YlkIcmm94An7lV0pkjTIvCSU74kX7a9jFjvLJ9SPrIk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BWVeWhB+TvWfmcQT65T+o1AWu0xvLNCAGTURU3tuFbM7X7I9slmXbRAZh+xlwrXVISYZdxKlIq49REBlfIMv0hy9kKH1cmj67kulVD17wuNUNp7hy8OMakEWHmJ3rUDUNnnV6o2Z4BKxD3AhxTwsT8xfoSxXPu/+4XDjG9xRwvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vDBZcSBh; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vDBZcSBh" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43494a20379so18662765e9.0 for ; Fri, 29 Nov 2024 08:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732897095; x=1733501895; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aVXqZCMu8xwpkslZ2hg8FShI0ONQIAKRUsutZKpKVHA=; b=vDBZcSBhzL5P1T9IqPlk2nskgN2YARoH+HO6DIL9mM2WDbIzythqUkOAINsTkJic29 SjyaP4kwYA9kh0TZLhPdZPE6Xx+fenjBXKzXR6EoLCKlcGLPiW406a4hIuTnuRhI5Bt0 Hi+hdf/yiEgLScJxfzjzyXW8+YrKyLo1FbyMkA6FxVN9jK5adN/is4RJnHFRvHQuGnu/ o23U9+JBXUWsXpPm0fYPB5yiGLMr1ptk2SQDGT2gWKbgXTLIwCBQysBZYFcUV+GyLuHV acS0MwJNC1E8aO2MhleSnZY0Yl2rPDCUomQVqu6uPm6nVYRo282571m/TkugxqRiv1hr 5roA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732897095; x=1733501895; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aVXqZCMu8xwpkslZ2hg8FShI0ONQIAKRUsutZKpKVHA=; b=EC4HzXcSR2f46XXLXZSLnyUEE3jU5O8ixsVmCUuZNvXJQj60fTL6bCTlmlxoHBnPnP UAPwHeDDcfcTYOnNHtXDu1w2x4u5Qm8929NyQ5Eo77GNed6WZO/dJ7v2jPmSvgAwcLyY et77DKGtHz0Vp0Q4KrVfIlUqnO3WuxvmUAaBKT/LUAaxaamLfPto162D+D2NspPnNEgu 5srCfR++CoSOiZDE8egp702b5fAVKN+gtEv5M1mcZU/VTLJId+pHtCABg3x6AyiiNdZL bSVbE1CyUXnD7ECMkFiSOE+cFblahQuKWcnV+1NsxWQmU3/lYpK4dIm7ziE6u+xvTBW2 W/hw== X-Forwarded-Encrypted: i=1; AJvYcCUi2MZl6ej6Ff1LDv671srsd+Kj+FsSEnw+z60o6y3rieZAzMY2xhhxyn/zV5dgxtCUqH+JLEkKhPZACRI=@vger.kernel.org X-Gm-Message-State: AOJu0YwgMRvjbTKK3PETZ4khuMo2xnyf1DpWAjCinq9KmIM8Ig64xrgo wlEz6i5cJrgD58suuwy47RidK6eu7zkbFuoDkymgRYUqVxaPRlRpVRoxf/0A104= X-Gm-Gg: ASbGnct4axzVFVPGl/LnCdIoFHOY5DUMbfbMq8AugaImc5YagIqfKvDLtYQ57wUtL31 rQtnXJ9zbYPvnKjP/Xf//FlN4+wAcda0bJ6Z9kvr7v9Idmv1hBzd/aGmJYhMh+Ntse+md+8xenf TBzwuxRfMSnKEDcMm1NvFRZ+AxqkvOwPD8LiBue9ZMMY0V/zBjuUT6cXAibfUMAXDoiX8PGz+Z1 54F7+8RmkMJzXrLroIbTBsOdat4z/wU6PdAAcOHKV1lNOwmYj5tBbfdUDA= X-Google-Smtp-Source: AGHT+IEA4WsTI+4NtsvW+R6TBXAs/4KeBqQkZDtbHYGltNPgZ4YcEuM2oS7x8HvfZlJiaa2HisRkGw== X-Received: by 2002:a05:600c:154d:b0:434:a555:d0d with SMTP id 5b1f17b1804b1-434a9e0e21dmr108116145e9.29.1732897094371; Fri, 29 Nov 2024 08:18:14 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:c54b:5636:4db3:1028]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b0dbf95fsm56771665e9.15.2024.11.29.08.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:18:13 -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, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: kprateek.nayak@amd.com, pauld@redhat.com, efault@gmx.de, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 10/10 v2] sched/fair: Fix variable declaration position Date: Fri, 29 Nov 2024 17:17:56 +0100 Message-ID: <20241129161756.3081386-11-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241129161756.3081386-1-vincent.guittot@linaro.org> References: <20241129161756.3081386-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move variable declaration at the beginning of the function Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c34874203da2..87552870958c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5632,6 +5632,7 @@ static int dequeue_entities(struct rq *rq, struct sch= ed_entity *se, int flags); static struct sched_entity * pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq) { + struct sched_entity *se; /* * Enabling NEXT_BUDDY will affect latency but not fairness. */ @@ -5642,7 +5643,7 @@ pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq) return cfs_rq->next; } =20 - struct sched_entity *se =3D pick_eevdf(cfs_rq); + se =3D pick_eevdf(cfs_rq); if (se->sched_delayed) { dequeue_entities(rq, se, DEQUEUE_SLEEP | DEQUEUE_DELAYED); SCHED_WARN_ON(se->sched_delayed); --=20 2.43.0