From nobody Mon Feb 9 01:51:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43732C0015E for ; Mon, 17 Jul 2023 21:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjGQV5j (ORCPT ); Mon, 17 Jul 2023 17:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjGQV5g (ORCPT ); Mon, 17 Jul 2023 17:57:36 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9A10E4C for ; Mon, 17 Jul 2023 14:57:35 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-315adee6ac8so4895176f8f.2 for ; Mon, 17 Jul 2023 14:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20221208.gappssmtp.com; s=20221208; t=1689631054; x=1692223054; 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=6WKkqfYoJtvShat8zNk6ttkEMMI9ZSxKElnGbDROIGI=; b=W7jaDxfX6dvC+U9iyxvyuDVKo6H7qavqtg2jvMoLKxBCTZuPoOHFVlTQrXCpJqDQHx eJvB+LYsQOvR9LSbDAeGnUnsyVHpgGmX2auYiaSbyVEzZ/lnJpRqqPGnjHqmMEZv4D3K Ln1PjhhZSE5GOPPwaJ6KVSfmMHxqyrfPPuHgdZ5whWwNeaLI9xSLXGLjwTjjelk8no3d o19XTolf2+p1x7o7QgbAbAK6KAFHuVHgHKcIkA9RdZVQDR1VHaZE7Ja3UsXDxJm0JHCK xHh2B7RqN/4g184BYbYuQuHms9ZcznWFKfHR+QSU4ne5Fo1Y8LOOEH/T3nFh62Pfc6pH u2ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689631054; x=1692223054; 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=6WKkqfYoJtvShat8zNk6ttkEMMI9ZSxKElnGbDROIGI=; b=UZlpchhJNhj/8coopl+8fsuKpAcl26KiUbfYmAGCcmDMEGpibqiuqTT7La/1XRyXxM nB+ndgO1BF2iK/0tL1gjkO9z9XNUV7O6WONGL1/EPGEZ8RBvCj3qCvjObYRpJ6o/7mo5 IVGEhUkOKmTXZOrc7t5EChDZ4esQX4y+IKhcTv+Pd//OaW1BUzewGEKaiHsZVOKGnhjb 7nJYh1AISfbtQrbFxgwNfKqdOrH2cwYVRrRhjvyaO6f8yX5O7RXL6rqbXTR0cSPNetif MLIBqSR83CLwZALeaGx8MJ+Sx2PB4eXS19w+fIB4QcmkSNTwAVp6xdJ2ILZOz/3yI817 oV9w== X-Gm-Message-State: ABy/qLZ/djRpJD1HQJqSQEFCyhbeQoDY4saqfSO9n1Qc0wOOZi2DMr9u oXkOA1KsLEGDPEc7BAQbW+OfrA== X-Google-Smtp-Source: APBJJlEJ7ma3iWeaBqU0E0BUmmMCsSdwAPhhr5l1MZCJ9pVtiYL4OvhoVW1YnWii05CBeEx3Yhbu6A== X-Received: by 2002:a05:6000:90e:b0:313:f07b:801f with SMTP id cw14-20020a056000090e00b00313f07b801fmr11440758wrb.44.1689631053851; Mon, 17 Jul 2023 14:57:33 -0700 (PDT) Received: from localhost.localdomain (host86-163-217-97.range86-163.btcentralplus.com. [86.163.217.97]) by smtp.gmail.com with ESMTPSA id m13-20020a7bce0d000000b003fbaa2903f4sm671285wmc.19.2023.07.17.14.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 14:57:33 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen , Hongyan Xia , Qais Yousef Subject: [PATCH v3 1/3] sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0 Date: Mon, 17 Jul 2023 22:57:15 +0100 Message-Id: <20230717215717.309174-2-qyousef@layalina.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717215717.309174-1-qyousef@layalina.io> References: <20230717215717.309174-1-qyousef@layalina.io> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When uclamp_max is being used, the util of the task could be higher than the spare capacity of the CPU, but due to uclamp_max value we force fit it there. The way the condition for checking for max_spare_cap in find_energy_efficient_cpu() was constructed; it ignored any CPU that has its spare_cap less than or _equal_ to max_spare_cap. Since we initialize max_spare_cap to 0; this lead to never setting max_spare_cap_cpu and hence ending up never performing compute_energy() for this cluster and missing an opportunity for a better energy efficient placement to honour uclamp_max setting. max_spare_cap =3D 0; cpu_cap =3D capacity_of(cpu) - task_util(p); // 0 if task_util(p) is high ... util_fits_cpu(...); // will return true if uclamp_max forces it to fit ... // this logic will fail to update max_spare_cap_cpu if cpu_cap is 0 if (cpu_cap > max_spare_cap) { max_spare_cap =3D cpu_cap; max_spare_cap_cpu =3D cpu; } prev_spare_cap suffers from a similar problem. Fix the logic by converting the variables into long and treating -1 value as 'not populated' instead of 0 which is a viable and correct spare capacity value. We need to be careful signed comparison is used when comparing with cpu_cap in one of the conditions. Fixes: 1d42509e475c ("sched/fair: Make EAS wakeup placement consider uclamp= restrictions") Signed-off-by: Qais Yousef (Google) Reviewed-by: Vincent Guittot --- kernel/sched/fair.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0cd1cdbae534..d489eece5a0d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7596,11 +7596,10 @@ static int find_energy_efficient_cpu(struct task_st= ruct *p, int prev_cpu) for (; pd; pd =3D pd->next) { unsigned long util_min =3D p_util_min, util_max =3D p_util_max; unsigned long cpu_cap, cpu_thermal_cap, util; - unsigned long cur_delta, max_spare_cap =3D 0; + long prev_spare_cap =3D -1, max_spare_cap =3D -1; unsigned long rq_util_min, rq_util_max; - unsigned long prev_spare_cap =3D 0; + unsigned long cur_delta, base_energy; int max_spare_cap_cpu =3D -1; - unsigned long base_energy; int fits, max_fits =3D -1; =20 cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask); @@ -7663,7 +7662,7 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) prev_spare_cap =3D cpu_cap; prev_fits =3D fits; } else if ((fits > max_fits) || - ((fits =3D=3D max_fits) && (cpu_cap > max_spare_cap))) { + ((fits =3D=3D max_fits) && ((long)cpu_cap > max_spare_cap))) { /* * Find the CPU with the maximum spare capacity * among the remaining CPUs in the performance @@ -7675,7 +7674,7 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) } } =20 - if (max_spare_cap_cpu < 0 && prev_spare_cap =3D=3D 0) + if (max_spare_cap_cpu < 0 && prev_spare_cap < 0) continue; =20 eenv_pd_busy_time(&eenv, cpus, p); @@ -7683,7 +7682,7 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) base_energy =3D compute_energy(&eenv, pd, cpus, p, -1); =20 /* Evaluate the energy impact of using prev_cpu. */ - if (prev_spare_cap > 0) { + if (prev_spare_cap > -1) { prev_delta =3D compute_energy(&eenv, pd, cpus, p, prev_cpu); /* CPU utilization has changed */ --=20 2.25.1 From nobody Mon Feb 9 01:51:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E56DC001DE for ; Mon, 17 Jul 2023 21:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjGQV5l (ORCPT ); Mon, 17 Jul 2023 17:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbjGQV5j (ORCPT ); Mon, 17 Jul 2023 17:57:39 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAFBFE4C for ; Mon, 17 Jul 2023 14:57:37 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbf1b82de7so31609945e9.1 for ; Mon, 17 Jul 2023 14:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20221208.gappssmtp.com; s=20221208; t=1689631056; x=1692223056; 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=LnEU7IyPXcZt92+8oUCYiT+upo6fdJ63NnSG75EIHJo=; b=sWpR9vlwo4Vjsmd/o4NAYCuZ967dRZ9yiQRE4cVUO5bp1VMmgBmDoND0iXLoyvJJqX UqHtLfK7LFDtJ7VR/WiXySJOKb+Kl4E1ruINwrQwG6sOPQBgUhyOeDYaOLcT0kNJ8KFB h6xdjA37+r+hydQ9KqUZJ0bbC6amDSVqb9uycdYc+jRzhVB+pclfa8t/pHVdTbDQFCs/ CfDfU466bd009AdWslJtR5pVUVjk5UBir55HIqXmYCAfwG+/ygvgv9M0dzoP/4lMxkcH Mmz/btk64wkHp3WCWhwmXa18R261N7pFw/oJypM/cfG4pFFWUkr4qmWdULlwgiBQbGCx giVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689631056; x=1692223056; 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=LnEU7IyPXcZt92+8oUCYiT+upo6fdJ63NnSG75EIHJo=; b=QWPqHsWHUtwNUKFCagr9WxR0GGWeg3b7ChfAKnTm9RNOy9uL6OWLHb1nxUm0asokxg SJ+0DX2YmQd0lx+3qd1zJl2UjfziOvnUzeZismcvjiZmXyxfUxWV/rLN1nZcesfVfgY2 uU606XPcGKobchxWXus5mv6e1P9zQ/FyLFt5+bovJ2LE+m/LiNJtYpzYHl7RB7TJdnyR B+QzIe/tGK5MDL4qllBX43rAOUm4UJfWm+ja1sx2LsxqV/hnlMs9xyrx+ZxYaishYDkj ccKr8AHjUkTbzM7XnYslTPkE6bUA7MhAGGL8Op9K+/0HD5xi500xkO/cEo+McYeYTOFN LGmA== X-Gm-Message-State: ABy/qLYAgsm+W3FHXJFn0bUwdEHKKGo9sA4Ch2qucdTxQhTFmYdSIE5I pUkXQynaZyL3Fvr4rwYwmuWqSg== X-Google-Smtp-Source: APBJJlHlEKhbOU+MWBX8IaREz4d9Dl4JzeGAI5jS1ox5TLtlX382zFGNHBX7vBeqO53d4ZTVw6QQXA== X-Received: by 2002:a05:600c:54c3:b0:3f9:68f:9c1a with SMTP id iw3-20020a05600c54c300b003f9068f9c1amr359377wmb.15.1689631056310; Mon, 17 Jul 2023 14:57:36 -0700 (PDT) Received: from localhost.localdomain (host86-163-217-97.range86-163.btcentralplus.com. [86.163.217.97]) by smtp.gmail.com with ESMTPSA id m13-20020a7bce0d000000b003fbaa2903f4sm671285wmc.19.2023.07.17.14.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 14:57:36 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen , Hongyan Xia , Qais Yousef Subject: [PATCH v3 2/3] sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 Date: Mon, 17 Jul 2023 22:57:16 +0100 Message-Id: <20230717215717.309174-3-qyousef@layalina.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717215717.309174-1-qyousef@layalina.io> References: <20230717215717.309174-1-qyousef@layalina.io> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" find_energy_efficient_cpu() bails out early if effective util of the task is 0 as the delta at this point will be zero and there's nothing for EAS to do. When uclamp is being used, this could lead to wrong decisions when uclamp_max is set to 0. In this case the task is capped to performance point 0, but it is actually running and consuming energy and we can benefit from EAS energy calculations. Rework the condition so that it bails out for when util is actually 0 or uclamp_min is requesting a higher performance point. We can do that without needing to use uclamp_task_util(); remove it. Fixes: d81304bc6193 ("sched/uclamp: Cater for uclamp in find_energy_efficie= nt_cpu()'s early exit condition") Signed-off-by: Qais Yousef (Google) Reviewed-by: Vincent Guittot --- kernel/sched/fair.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d489eece5a0d..c701f490ca4c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4348,22 +4348,6 @@ static inline unsigned long task_util_est(struct tas= k_struct *p) return max(task_util(p), _task_util_est(p)); } =20 -#ifdef CONFIG_UCLAMP_TASK -static inline unsigned long uclamp_task_util(struct task_struct *p, - unsigned long uclamp_min, - unsigned long uclamp_max) -{ - return clamp(task_util_est(p), uclamp_min, uclamp_max); -} -#else -static inline unsigned long uclamp_task_util(struct task_struct *p, - unsigned long uclamp_min, - unsigned long uclamp_max) -{ - return task_util_est(p); -} -#endif - static inline void util_est_enqueue(struct cfs_rq *cfs_rq, struct task_struct *p) { @@ -7588,7 +7572,7 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) target =3D prev_cpu; =20 sync_entity_load_avg(&p->se); - if (!uclamp_task_util(p, p_util_min, p_util_max)) + if (!task_util_est(p) && p_util_min =3D=3D 0) goto unlock; =20 eenv_task_busy_time(&eenv, p, prev_cpu); --=20 2.25.1 From nobody Mon Feb 9 01:51:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD543EB64DC for ; Mon, 17 Jul 2023 21:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbjGQV5o (ORCPT ); Mon, 17 Jul 2023 17:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjGQV5k (ORCPT ); Mon, 17 Jul 2023 17:57:40 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12DAE4C for ; Mon, 17 Jul 2023 14:57:39 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fc04692e20so51360285e9.0 for ; Mon, 17 Jul 2023 14:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20221208.gappssmtp.com; s=20221208; t=1689631058; x=1692223058; 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=TO1uwXv0rKYcU5XA4mBEnIS/I8OBYJT4uTImWwVx+iU=; b=u5VC9bPjM31LYY49sGBAq8cfSSsUJ2m9npkn3SUXvvL4fW+is7gT4uWJq6lgN10szp ENKkbaj8hJM//vVfoDIbRWmu2blikdUxhGKqhYlE40qqbav3U4VoS6HeoXtSRxkN1KvD MWYEBQJea/s+SYzjdOZRHAlujbDJu0I3resYXVD4iBZUpuG343nMYodFuU3vixolhRC6 +x8im6SPAZZnSsFrhvEHiYcqCNzSSZh/Mrr1s5t18cEbhqsz9uwM4Xo01uhMYKDsksaw HmuaDHCuyoGLGESMA/CqTLgA2om5qGPENkWdk+BGymYUj3aeHUpDuNUQldR0GDeHzpLm p0Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689631058; x=1692223058; 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=TO1uwXv0rKYcU5XA4mBEnIS/I8OBYJT4uTImWwVx+iU=; b=Nj0BjXSVCJ9Idx/4D2tVDCCrGaX+MYrjQBmwsuNItAfe7fW30xIlDGcE7NG0Vgdx+B EDgH3ahZqRT79l0ScrTBJOGBMLRGWaw5NJzqW2k2UWE6kapRFkFwg2+NJNi2dMRUO06T GAvNjrhfufMlB3+R4U94AJtn8CvK6cvjfmIac2P8nYDLeVKEl4nj4P/DLBBYvuoWsDwK Xs7uauMgaVa1zPTLDpBOVjZihuMrXQbSZ+oBu6USQLoXm4M4Ll4T839dfR6phhV1wMoA 6FanVXsMPSwAf+5IzCLzh8AjK9g4prXm7V29df2CxIA9TSqT2oJCNXU9QVLPmG8xMV8+ YJeA== X-Gm-Message-State: ABy/qLba+zGpIdYG1fQ/RFDR/hjRxHiThxHGuLuSif8daNJ7HqQStnvh PKqPGoQILfVOpZQjh6E+x1G0aA== X-Google-Smtp-Source: APBJJlFfofHxFcS82r5U72ZGyKbpx7Lnz/PTgxlIK/+6xOqfs/GRKZszhI7PjgLWINrbDHg1I7rOkw== X-Received: by 2002:a7b:c85a:0:b0:3fb:b56b:470f with SMTP id c26-20020a7bc85a000000b003fbb56b470fmr405904wml.14.1689631058214; Mon, 17 Jul 2023 14:57:38 -0700 (PDT) Received: from localhost.localdomain (host86-163-217-97.range86-163.btcentralplus.com. [86.163.217.97]) by smtp.gmail.com with ESMTPSA id m13-20020a7bce0d000000b003fbaa2903f4sm671285wmc.19.2023.07.17.14.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 14:57:37 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen , Hongyan Xia , Qais Yousef Subject: [PATCH v3 3/3] sched/tp: Add new tracepoint to track compute energy computation Date: Mon, 17 Jul 2023 22:57:17 +0100 Message-Id: <20230717215717.309174-4-qyousef@layalina.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717215717.309174-1-qyousef@layalina.io> References: <20230717215717.309174-1-qyousef@layalina.io> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It was useful to track feec() placement decision and debug the spare capacity and optimization issues vs uclamp_max. Signed-off-by: Qais Yousef (Google) --- include/trace/events/sched.h | 4 ++++ kernel/sched/core.c | 1 + kernel/sched/fair.c | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbb99a61f714..20cc884f72ff 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -735,6 +735,10 @@ DECLARE_TRACE(sched_update_nr_running_tp, TP_PROTO(struct rq *rq, int change), TP_ARGS(rq, change)); =20 +DECLARE_TRACE(sched_compute_energy_tp, + TP_PROTO(struct task_struct *p, int dst_cpu, unsigned long energy), + TP_ARGS(p, dst_cpu, energy)); + #endif /* _TRACE_SCHED_H */ =20 /* This part must be outside protection */ diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 83e36547af17..2deca2dca625 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -114,6 +114,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_se_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_compute_energy_tp); =20 DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); =20 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c701f490ca4c..23e026393210 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7493,11 +7493,16 @@ compute_energy(struct energy_env *eenv, struct perf= _domain *pd, { unsigned long max_util =3D eenv_pd_max_util(eenv, pd_cpus, p, dst_cpu); unsigned long busy_time =3D eenv->pd_busy_time; + unsigned long energy; =20 if (dst_cpu >=3D 0) busy_time =3D min(eenv->pd_cap, busy_time + eenv->task_busy_time); =20 - return em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap); + energy =3D em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap); + + trace_sched_compute_energy_tp(p, dst_cpu, energy); + + return energy; } =20 /* --=20 2.25.1