diff mbox series

[1/1] sched_get_priority_max01: Add more policies

Message ID 20211220201814.31596-1-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/1] sched_get_priority_max01: Add more policies | expand

Commit Message

Petr Vorel Dec. 20, 2021, 8:18 p.m. UTC
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../sched_get_priority_max/sched_get_priority_max01.c    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Cyril Hrubis Dec. 21, 2021, 4:06 p.m. UTC | #1
Hi!
> diff --git a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> index a1c54efd0e..0d01317033 100644
> --- a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> +++ b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> @@ -13,6 +13,8 @@
>   * compare them with expected value.
>   */
>  
> +#define _GNU_SOURCE

I supposed that we need this for SCHED_DEADLINE right? What about
alternative libc implementations, does they define SCHED_DEADLINE as
well? Do we need a fallback?

>  #include <sched.h>
>  #include "lapi/syscalls.h"
>  #include "tst_test.h"
> @@ -24,9 +26,12 @@ static struct test_case {
>  	int policy;
>  	int retval;
>  } tcases[] = {
> -	{POLICY_DESC(SCHED_OTHER), 0},
> +	{POLICY_DESC(SCHED_BATCH), 0},
> +	{POLICY_DESC(SCHED_DEADLINE), 0},
>  	{POLICY_DESC(SCHED_FIFO), 99},
> -	{POLICY_DESC(SCHED_RR), 99}
> +	{POLICY_DESC(SCHED_IDLE), 0},
> +	{POLICY_DESC(SCHED_OTHER), 0},
> +	{POLICY_DESC(SCHED_RR), 99},
>  };
>  
>  static void run_test(unsigned int nr)
> -- 
> 2.34.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel Jan. 24, 2022, 2:21 p.m. UTC | #2
Hi Cyril,

> Hi!
> > diff --git a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> > index a1c54efd0e..0d01317033 100644
> > --- a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> > +++ b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
> > @@ -13,6 +13,8 @@
> >   * compare them with expected value.
> >   */

> > +#define _GNU_SOURCE

> I supposed that we need this for SCHED_DEADLINE right? What about
> alternative libc implementations, does they define SCHED_DEADLINE as
> well? Do we need a fallback?

Sorry for the delay (I did write a reply, but probably forget to sent).
musl and glibc support all of them, but uclibc-ng doesn't have SCHED_DEADLINE.
(and SCHED_RESET_ON_FORK). I'll send v2 with SCHED_DEADLINE fallback.

I guess SCHED_RESET_ON_FORK would deserve it's own test (man sched(7):
when set, children created by fork(2) do not inherit privileged scheduling
policies).

Kind regards,
Petr
Cyril Hrubis Jan. 25, 2022, 10:50 a.m. UTC | #3
Hi!
> > I supposed that we need this for SCHED_DEADLINE right? What about
> > alternative libc implementations, does they define SCHED_DEADLINE as
> > well? Do we need a fallback?
> 
> Sorry for the delay (I did write a reply, but probably forget to sent).
> musl and glibc support all of them, but uclibc-ng doesn't have SCHED_DEADLINE.
> (and SCHED_RESET_ON_FORK). I'll send v2 with SCHED_DEADLINE fallback.

Sounds good.

> I guess SCHED_RESET_ON_FORK would deserve it's own test (man sched(7):
> when set, children created by fork(2) do not inherit privileged scheduling
> policies).

Yes please. Either write the test or at least create a github issue.
Petr Vorel Jan. 25, 2022, 11:20 a.m. UTC | #4
...
> > I guess SCHED_RESET_ON_FORK would deserve it's own test (man sched(7):
> > when set, children created by fork(2) do not inherit privileged scheduling
> > policies).

> Yes please. Either write the test or at least create a github issue.

https://github.com/linux-test-project/ltp/issues/905
Marked as easyhack and wait some time to let new comers to take it before
implementing it myself.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
index a1c54efd0e..0d01317033 100644
--- a/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
+++ b/testcases/kernel/syscalls/sched_get_priority_max/sched_get_priority_max01.c
@@ -13,6 +13,8 @@ 
  * compare them with expected value.
  */
 
+#define _GNU_SOURCE
+
 #include <sched.h>
 #include "lapi/syscalls.h"
 #include "tst_test.h"
@@ -24,9 +26,12 @@  static struct test_case {
 	int policy;
 	int retval;
 } tcases[] = {
-	{POLICY_DESC(SCHED_OTHER), 0},
+	{POLICY_DESC(SCHED_BATCH), 0},
+	{POLICY_DESC(SCHED_DEADLINE), 0},
 	{POLICY_DESC(SCHED_FIFO), 99},
-	{POLICY_DESC(SCHED_RR), 99}
+	{POLICY_DESC(SCHED_IDLE), 0},
+	{POLICY_DESC(SCHED_OTHER), 0},
+	{POLICY_DESC(SCHED_RR), 99},
 };
 
 static void run_test(unsigned int nr)