linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode
@ 2021-03-25  0:45 Rasmus Villemoes
  2021-03-25  0:45 ` [PATCH 2/2] sched: use -EINVAL " Rasmus Villemoes
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2021-03-25  0:45 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Rasmus Villemoes

Use the enum names which are also what is used in the switch() in
sched_dynamic_update().

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 kernel/sched/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 98191218d891..3959481261bb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5370,13 +5370,13 @@ static int preempt_dynamic_mode = preempt_dynamic_full;
 static int sched_dynamic_mode(const char *str)
 {
 	if (!strcmp(str, "none"))
-		return 0;
+		return preempt_dynamic_none;
 
 	if (!strcmp(str, "voluntary"))
-		return 1;
+		return preempt_dynamic_voluntary;
 
 	if (!strcmp(str, "full"))
-		return 2;
+		return preempt_dynamic_full;
 
 	return -1;
 }
-- 
2.29.2


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

* [PATCH 2/2] sched: use -EINVAL in sched_dynamic_mode
  2021-03-25  0:45 [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Rasmus Villemoes
@ 2021-03-25  0:45 ` Rasmus Villemoes
  2021-03-25 11:08   ` [tip: sched/core] sched/core: Use -EINVAL in sched_dynamic_mode() tip-bot2 for Rasmus Villemoes
  2021-03-25  7:48 ` [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Peter Zijlstra
  2021-03-25 11:08 ` [tip: sched/core] sched/core: Stop using magic values in sched_dynamic_mode() tip-bot2 for Rasmus Villemoes
  2 siblings, 1 reply; 5+ messages in thread
From: Rasmus Villemoes @ 2021-03-25  0:45 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Rasmus Villemoes

-1 is -EPERM which is a somewhat odd error to return from
sched_dynamic_write(). No other callers care about which negative
value is used.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 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 3959481261bb..5b29261668a6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5378,7 +5378,7 @@ static int sched_dynamic_mode(const char *str)
 	if (!strcmp(str, "full"))
 		return preempt_dynamic_full;
 
-	return -1;
+	return -EINVAL;
 }
 
 static void sched_dynamic_update(int mode)
-- 
2.29.2


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

* Re: [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode
  2021-03-25  0:45 [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Rasmus Villemoes
  2021-03-25  0:45 ` [PATCH 2/2] sched: use -EINVAL " Rasmus Villemoes
@ 2021-03-25  7:48 ` Peter Zijlstra
  2021-03-25 11:08 ` [tip: sched/core] sched/core: Stop using magic values in sched_dynamic_mode() tip-bot2 for Rasmus Villemoes
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2021-03-25  7:48 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Ingo Molnar, linux-kernel

On Thu, Mar 25, 2021 at 01:45:14AM +0100, Rasmus Villemoes wrote:
> Use the enum names which are also what is used in the switch() in
> sched_dynamic_update().
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Thanks for both!

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

* [tip: sched/core] sched/core: Use -EINVAL in sched_dynamic_mode()
  2021-03-25  0:45 ` [PATCH 2/2] sched: use -EINVAL " Rasmus Villemoes
@ 2021-03-25 11:08   ` tip-bot2 for Rasmus Villemoes
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Rasmus Villemoes @ 2021-03-25 11:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Rasmus Villemoes, Ingo Molnar, Peter Zijlstra, x86, linux-kernel

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

Commit-ID:     c4681f3f1cfcfde0c95ff72f0bdb43f9ffd7f00e
Gitweb:        https://git.kernel.org/tip/c4681f3f1cfcfde0c95ff72f0bdb43f9ffd7f00e
Author:        Rasmus Villemoes <linux@rasmusvillemoes.dk>
AuthorDate:    Thu, 25 Mar 2021 01:45:15 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 25 Mar 2021 11:39:13 +01:00

sched/core: Use -EINVAL in sched_dynamic_mode()

-1 is -EPERM which is a somewhat odd error to return from
sched_dynamic_write(). No other callers care about which negative
value is used.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: https://lore.kernel.org/r/20210325004515.531631-2-linux@rasmusvillemoes.dk
---
 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 1fe9d3f..95bd6ab 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5384,7 +5384,7 @@ static int sched_dynamic_mode(const char *str)
 	if (!strcmp(str, "full"))
 		return preempt_dynamic_full;
 
-	return -1;
+	return -EINVAL;
 }
 
 static void sched_dynamic_update(int mode)

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

* [tip: sched/core] sched/core: Stop using magic values in sched_dynamic_mode()
  2021-03-25  0:45 [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Rasmus Villemoes
  2021-03-25  0:45 ` [PATCH 2/2] sched: use -EINVAL " Rasmus Villemoes
  2021-03-25  7:48 ` [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Peter Zijlstra
@ 2021-03-25 11:08 ` tip-bot2 for Rasmus Villemoes
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Rasmus Villemoes @ 2021-03-25 11:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Rasmus Villemoes, Ingo Molnar, Peter Zijlstra, x86, linux-kernel

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

Commit-ID:     7e1b2eb74928b2478fd0630ce6c664334b480d00
Gitweb:        https://git.kernel.org/tip/7e1b2eb74928b2478fd0630ce6c664334b480d00
Author:        Rasmus Villemoes <linux@rasmusvillemoes.dk>
AuthorDate:    Thu, 25 Mar 2021 01:45:14 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 25 Mar 2021 11:39:12 +01:00

sched/core: Stop using magic values in sched_dynamic_mode()

Use the enum names which are also what is used in the switch() in
sched_dynamic_update().

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: https://lore.kernel.org/r/20210325004515.531631-1-linux@rasmusvillemoes.dk
---
 kernel/sched/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3384ea7..1fe9d3f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5376,13 +5376,13 @@ static int preempt_dynamic_mode = preempt_dynamic_full;
 static int sched_dynamic_mode(const char *str)
 {
 	if (!strcmp(str, "none"))
-		return 0;
+		return preempt_dynamic_none;
 
 	if (!strcmp(str, "voluntary"))
-		return 1;
+		return preempt_dynamic_voluntary;
 
 	if (!strcmp(str, "full"))
-		return 2;
+		return preempt_dynamic_full;
 
 	return -1;
 }

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

end of thread, other threads:[~2021-03-25 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25  0:45 [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Rasmus Villemoes
2021-03-25  0:45 ` [PATCH 2/2] sched: use -EINVAL " Rasmus Villemoes
2021-03-25 11:08   ` [tip: sched/core] sched/core: Use -EINVAL in sched_dynamic_mode() tip-bot2 for Rasmus Villemoes
2021-03-25  7:48 ` [PATCH 1/2] sched: stop using magic values in sched_dynamic_mode Peter Zijlstra
2021-03-25 11:08 ` [tip: sched/core] sched/core: Stop using magic values in sched_dynamic_mode() tip-bot2 for Rasmus Villemoes

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).