Re: [PATCH 4/4] chrt: don't rely on exact values of SCHED_* defines

2018-01-13 Thread Kang-Che Sung
On Sun, Jan 14, 2018 at 5:30 AM, Povilas Kanapickas wrote: > --- a/util-linux/chrt.c > +++ b/util-linux/chrt.c > @@ -36,17 +36,20 @@ > #include > #include "libbb.h" > > -static const struct { > - int policy; > - char name[sizeof("SCHED_OTHER")]; > -} policies[] = { > - {SCHED_

[PATCH 3/4] chrt: fix incorrect maximum priority on SCHED_{OTHER,BATCH,IDLE}

2018-01-13 Thread Povilas Kanapickas
--- util-linux/chrt.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/util-linux/chrt.c b/util-linux/chrt.c index bbd6e2deb..5c5513aeb 100644 --- a/util-linux/chrt.c +++ b/util-linux/chrt.c @@ -78,6 +78,8 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)

[PATCH 2/4] chrt: add support for SCHED_IDLE

2018-01-13 Thread Povilas Kanapickas
--- util-linux/chrt.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/util-linux/chrt.c b/util-linux/chrt.c index e7abd4f5a..bbd6e2deb 100644 --- a/util-linux/chrt.c +++ b/util-linux/chrt.c @@ -17,7 +17,7 @@ //kbuild:lib-$(CONFIG_CHRT) += chrt.o //usa

[PATCH 1/4] chrt: add support for SCHED_BATCH

2018-01-13 Thread Povilas Kanapickas
--- util-linux/chrt.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/util-linux/chrt.c b/util-linux/chrt.c index 2712ea3e3..e7abd4f5a 100644 --- a/util-linux/chrt.c +++ b/util-linux/chrt.c @@ -17,13 +17,14 @@ //kbuild:lib-$(CONFIG_CHRT) += chrt.o //usage:

[PATCH 0/4] Add SCHED_BATCH and SCHED_IDLE support to chrt

2018-01-13 Thread Povilas Kanapickas
Hi, The following patches add SCHED_BATCH and SCHED_IDLE support to chrt. The priority limits are fixed to follow the specification. The last patch avoids hardcoding the values of SCHED_* macros as array indices. Perhaps counter-intuitively, this leads to binary size reduction of 90 bytes on x86

[PATCH 4/4] chrt: don't rely on exact values of SCHED_* defines

2018-01-13 Thread Povilas Kanapickas
--- util-linux/chrt.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/util-linux/chrt.c b/util-linux/chrt.c index 5c5513aeb..8fd4b7bea 100644 --- a/util-linux/chrt.c +++ b/util-linux/chrt.c @@ -36,17 +36,20 @@ #include #include "libbb.h" -s