linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/core: uclamp: fix wrong condition
@ 2019-11-14 21:10 Qais Yousef
  2019-11-15  8:02 ` Vincent Guittot
  2019-11-15 18:13 ` [tip: sched/urgent] sched/uclamp: Fix incorrect condition tip-bot2 for Qais Yousef
  0 siblings, 2 replies; 3+ messages in thread
From: Qais Yousef @ 2019-11-14 21:10 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Qais Yousef, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Patrick Bellasi,
	linux-kernel

uclamp_update_active() should perform the update when
p->uclamp[clamp_id].active is true. But when the logic was inverted in
[1], the if condition wasn't inverted correctly too.

[1] https://lore.kernel.org/lkml/20190902073836.GO2369@hirez.programming.kicks-ass.net/

Fixes: babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")
Reported-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Juri Lelli <juri.lelli@redhat.com>
CC: Vincent Guittot <vincent.guittot@linaro.org>
CC: Dietmar Eggemann <dietmar.eggemann@arm.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ben Segall <bsegall@google.com>
CC: Mel Gorman <mgorman@suse.de>
CC: Patrick Bellasi <patrick.bellasi@matbug.net>
CC: linux-kernel@vger.kernel.org
---
 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 0f2eb3629070..2de53489c909 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1065,7 +1065,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	 * affecting a valid clamp bucket, the next time it's enqueued,
 	 * it will already see the updated clamp bucket value.
 	 */
-	if (!p->uclamp[clamp_id].active) {
+	if (p->uclamp[clamp_id].active) {
 		uclamp_rq_dec_id(rq, p, clamp_id);
 		uclamp_rq_inc_id(rq, p, clamp_id);
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/core: uclamp: fix wrong condition
  2019-11-14 21:10 [PATCH] sched/core: uclamp: fix wrong condition Qais Yousef
@ 2019-11-15  8:02 ` Vincent Guittot
  2019-11-15 18:13 ` [tip: sched/urgent] sched/uclamp: Fix incorrect condition tip-bot2 for Qais Yousef
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Guittot @ 2019-11-15  8:02 UTC (permalink / raw)
  To: Qais Yousef
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Patrick Bellasi,
	linux-kernel

On Thu, 14 Nov 2019 at 22:10, Qais Yousef <qais.yousef@arm.com> wrote:
>
> uclamp_update_active() should perform the update when
> p->uclamp[clamp_id].active is true. But when the logic was inverted in
> [1], the if condition wasn't inverted correctly too.
>
> [1] https://lore.kernel.org/lkml/20190902073836.GO2369@hirez.programming.kicks-ass.net/
>
> Fixes: babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")
> Reported-by: Suren Baghdasaryan <surenb@google.com>
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> CC: Juri Lelli <juri.lelli@redhat.com>
> CC: Vincent Guittot <vincent.guittot@linaro.org>
> CC: Dietmar Eggemann <dietmar.eggemann@arm.com>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Ben Segall <bsegall@google.com>
> CC: Mel Gorman <mgorman@suse.de>
> CC: Patrick Bellasi <patrick.bellasi@matbug.net>
> CC: linux-kernel@vger.kernel.org

Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  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 0f2eb3629070..2de53489c909 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1065,7 +1065,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
>          * affecting a valid clamp bucket, the next time it's enqueued,
>          * it will already see the updated clamp bucket value.
>          */
> -       if (!p->uclamp[clamp_id].active) {
> +       if (p->uclamp[clamp_id].active) {
>                 uclamp_rq_dec_id(rq, p, clamp_id);
>                 uclamp_rq_inc_id(rq, p, clamp_id);
>         }
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: sched/urgent] sched/uclamp: Fix incorrect condition
  2019-11-14 21:10 [PATCH] sched/core: uclamp: fix wrong condition Qais Yousef
  2019-11-15  8:02 ` Vincent Guittot
@ 2019-11-15 18:13 ` tip-bot2 for Qais Yousef
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Qais Yousef @ 2019-11-15 18:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Suren Baghdasaryan, Qais Yousef, Peter Zijlstra (Intel),
	Vincent Guittot, Ben Segall, Dietmar Eggemann, Juri Lelli,
	Linus Torvalds, Mel Gorman, Patrick Bellasi, Steven Rostedt,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, linux-kernel

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     6e1ff0773f49c7d38e8b4a9df598def6afb9f415
Gitweb:        https://git.kernel.org/tip/6e1ff0773f49c7d38e8b4a9df598def6afb9f415
Author:        Qais Yousef <qais.yousef@arm.com>
AuthorDate:    Thu, 14 Nov 2019 21:10:52 
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Nov 2019 11:02:18 +01:00

sched/uclamp: Fix incorrect condition

uclamp_update_active() should perform the update when
p->uclamp[clamp_id].active is true. But when the logic was inverted in
[1], the if condition wasn't inverted correctly too.

[1] https://lore.kernel.org/lkml/20190902073836.GO2369@hirez.programming.kicks-ass.net/

Reported-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Patrick Bellasi <patrick.bellasi@matbug.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")
Link: https://lkml.kernel.org/r/20191114211052.15116-1-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 33cd250..44123b4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1065,7 +1065,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	 * affecting a valid clamp bucket, the next time it's enqueued,
 	 * it will already see the updated clamp bucket value.
 	 */
-	if (!p->uclamp[clamp_id].active) {
+	if (p->uclamp[clamp_id].active) {
 		uclamp_rq_dec_id(rq, p, clamp_id);
 		uclamp_rq_inc_id(rq, p, clamp_id);
 	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-15 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 21:10 [PATCH] sched/core: uclamp: fix wrong condition Qais Yousef
2019-11-15  8:02 ` Vincent Guittot
2019-11-15 18:13 ` [tip: sched/urgent] sched/uclamp: Fix incorrect condition tip-bot2 for Qais Yousef

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).