From nobody Wed Oct 8 18:16:16 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 BB8CB2DFA35 for ; Wed, 25 Jun 2025 20:31:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750883486; cv=none; b=KvlsdB0OCJPJpec8a99NqMhsFIzrqand1m8ML/7djyjbmCXOo3Je6XxxIHGHxUEoQfM5TGjPTwe2zL9WvQOrNNbZfl0k2aCAIjm26tjRTRhvdKEjomeM/Z/MJNY48jYEtFcBqMsPL2MZDjdZAxJoLy9HQiGMmjycgzQ3WG9pA58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750883486; c=relaxed/simple; bh=nLZ/ViKh9mCSmL/QUFoTZ524l89j3+XT4qT6eKR2NHc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=CR5PLETLNZJcjKnzhOOtzbGOZHVTfKgY846l8tQDW9OHj2mdxo5soGYyiP2pfVe8vOsCsKaYWGCTR1Bh6w8R27yAP0WI3/dcTyjpMnD2IW/5xx/M4oyNMYZAXFva77W5HIvvtN9yLtn9JQmF5doMKCoKxRqlT/J7vyhLw0p5wlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PyzaRGm+; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PyzaRGm+" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-3132c8437ffso293686a91.1 for ; Wed, 25 Jun 2025 13:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750883484; x=1751488284; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fWMZEwaLzB4ZLAXRICQvTxcHO4sAmAm0N54ZCGAyYPs=; b=PyzaRGm+QBDX76TZmNSgaY6a30iD59r82MQrFwjfkiWb8nUwCnWkAMZ/pAJhKvN+W+ 3PNC1gs8Q7+nCwWaCv8DqJwBrMzdkHZW0Y0Xl96MECbabiX3C2fk2DKGRIBrisVAu14t 54hvK4TAbCJvC5lq7YG5K4Uam3uqdh7/kxC5hOUs4zp0pP+jAQwv0flR0IXMTzKz4QfL 2GY+VtsuuqjgpajTcGVQ6+dzBYgS1eOxqHYLUlWNHrBIZVBXF3cLe9mRQl/ckldE4P+y +YWqCo1pPJy6kJSQKg0R9LDkEnT7+L1yjAbd7Em3EZkY/sDkrh93Kkrq2inkEf0nUOYP 4kGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750883484; x=1751488284; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fWMZEwaLzB4ZLAXRICQvTxcHO4sAmAm0N54ZCGAyYPs=; b=hlux4hpmGl7+hdE5w1vR3M69d5w8kb0DpHfDoyIz0P9c0FlVeSvzUllfGcW+FPJSCY IQ10GfgEphEDEWzlNNckrotXKeLb/xPYmY2eWVm+XNpYAYu85Ki+GZxrW9U+/TXq9vxp j0Z9hHN4PuydKu9a4Cm5UzSW/kgg6ycFIcUScIx2nSBkDl8V9Wb42Yvxcrr70H67lfv1 ZpcHqb/CHbWVMJBsskdHC2cnF8ZGD7XdgMwtuqC+zK5zxIxxU5RxtZZ4pj1L3NpnX2j3 okikOWHlHnQlnv0WheSY4EwFWqgksQO1gaxUWQblNa6DJPVjA+3rVkXBMSE/ksq8KehW PvBg== X-Gm-Message-State: AOJu0YzT5juEu6k4NVfd4O3LAQ1vrkwGbIoh/1ZpVMENS3tV84IXMy+p 4AHZowA0Ua6TjV3yBorZnBpe5iXrtDEnvcnp6CnxPXkGQZVlzf/jIL2bhmGIpZyHwLqMqHn45JE c+5Y1pY+SS8Q8vJ5wsX3Aks/Lbdu/oyMmZl19I4T4NVrhiG5niYTHIFOTRuPGlgvT41wiaoxb2z /t95ya9FsKDVugmYIGum8OHkYsF4Suw/NnsigTi1UYE1Kca6GB X-Google-Smtp-Source: AGHT+IF+V1NliafRtG0Qu5AbXO5KkZeLJZHhGeYYmtoo+Ilo+hYYd6k76OF3fjQfn6z52FmBUmPy2RU6z28w X-Received: from pjbdy12.prod.google.com ([2002:a17:90b:6cc:b0:311:462d:cb60]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:53c5:b0:312:1508:fb4e with SMTP id 98e67ed59e1d1-315f2675bbbmr6780975a91.17.1750883483656; Wed, 25 Jun 2025 13:31:23 -0700 (PDT) Date: Wed, 25 Jun 2025 20:30:57 +0000 In-Reply-To: <20250625203110.2299275-1-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250625203110.2299275-1-jstultz@google.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Message-ID: <20250625203110.2299275-5-jstultz@google.com> Subject: [PATCH v18 4/8] sched: Move update_curr_task logic into update_curr_se From: John Stultz To: LKML Cc: John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , K Prateek Nayak , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , kernel-team@android.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Absorb update_curr_task() into update_curr_se(), and in the process simplify update_curr_common(). This will make the next step a bit easier. Signed-off-by: John Stultz --- Cc: Joel Fernandes Cc: Qais Yousef Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Steven Rostedt Cc: Ben Segall Cc: Zimuzo Ezeozue Cc: Mel Gorman Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E. McKenney" Cc: Metin Kaya Cc: Xuewen Yan Cc: K Prateek Nayak Cc: Thomas Gleixner Cc: Daniel Lezcano Cc: Suleiman Souhlal Cc: kuyo chang Cc: hupu Cc: kernel-team@android.com --- kernel/sched/fair.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7a14da5396fb2..edcc7d59ecc3b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1155,6 +1155,14 @@ static s64 update_curr_se(struct rq *rq, struct sche= d_entity *curr) curr->exec_start =3D now; curr->sum_exec_runtime +=3D delta_exec; =20 + if (entity_is_task(curr)) { + struct task_struct *p =3D task_of(curr); + + trace_sched_stat_runtime(p, delta_exec); + account_group_exec_runtime(p, delta_exec); + cgroup_account_cputime(p, delta_exec); + } + if (schedstat_enabled()) { struct sched_statistics *stats; =20 @@ -1166,13 +1174,6 @@ static s64 update_curr_se(struct rq *rq, struct sche= d_entity *curr) return delta_exec; } =20 -static inline void update_curr_task(struct task_struct *p, s64 delta_exec) -{ - trace_sched_stat_runtime(p, delta_exec); - account_group_exec_runtime(p, delta_exec); - cgroup_account_cputime(p, delta_exec); -} - static inline bool did_preempt_short(struct cfs_rq *cfs_rq, struct sched_e= ntity *curr) { if (!sched_feat(PREEMPT_SHORT)) @@ -1211,13 +1212,8 @@ static inline bool do_preempt_short(struct cfs_rq *c= fs_rq, s64 update_curr_common(struct rq *rq) { struct task_struct *donor =3D rq->donor; - s64 delta_exec; =20 - delta_exec =3D update_curr_se(rq, &donor->se); - if (likely(delta_exec > 0)) - update_curr_task(donor, delta_exec); - - return delta_exec; + return update_curr_se(rq, &donor->se); } =20 /* @@ -1242,10 +1238,6 @@ static void update_curr(struct cfs_rq *cfs_rq) update_min_vruntime(cfs_rq); =20 if (entity_is_task(curr)) { - struct task_struct *p =3D task_of(curr); - - update_curr_task(p, delta_exec); - /* * If the fair_server is active, we need to account for the * fair_server time whether or not the task is running on --=20 2.50.0.727.gbf7dc18ff4-goog