All of lore.kernel.org
 help / color / mirror / Atom feed
* Why does ionice(1) ban the user to set back to 'none' class?
@ 2012-06-18 11:48 Zheng Liu
  2012-06-18 13:28 ` Jens Axboe
  2012-06-18 14:26 ` Rob Landley
  0 siblings, 2 replies; 7+ messages in thread
From: Zheng Liu @ 2012-06-18 11:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Rob Landley, linux-doc, linux-kernel

Hi Jens,

I meet a problem when I use ionice(1) to adjust a process's io priority.
I do the following operations:

$ ionice -p${pid}
none: prio 0
$ ionice -p${pid} -c2 -n4
$ ionice -p${pid}
best-effort: prio 4
$ ionice -p${pid} -c0 -n0
$ ionice -p${pid}
best-effort: prio 0

So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
read the docs about ionice in [1].  I notice this code:

switch (ioprio_class) {
	case IOPRIO_CLASS_NONE:
		ioprio_class = IOPRIO_CLASS_BE;
                               ^^^^^^^^^^^^^^^^
                               *It means that we cannot set back to none.*
		break;
	case IOPRIO_CLASS_RT:
	case IOPRIO_CLASS_BE:
		break;
	case IOPRIO_CLASS_IDLE:
		ioprio = 7;
		break;
	default:
		printf("bad prio class %d\n", ioprio_class);
		return 1;
}

My question is why we need to ban the user to set back to 'none'.  Is there
some reasons?  Thank you.

[Sorry, I don't subscribe linux-doc and linux-kernel mailing list.
Please CC to me.]

1. ${linux_src}/Documentation/block/ioprio.txt.

Regards,
Zheng

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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-18 11:48 Why does ionice(1) ban the user to set back to 'none' class? Zheng Liu
@ 2012-06-18 13:28 ` Jens Axboe
  2012-06-19  2:11   ` gnehzuil.lzheng
  2012-06-18 14:26 ` Rob Landley
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2012-06-18 13:28 UTC (permalink / raw)
  To: Rob Landley, linux-doc, linux-kernel

On 06/18/2012 01:48 PM, Zheng Liu wrote:
> Hi Jens,
> 
> I meet a problem when I use ionice(1) to adjust a process's io priority.
> I do the following operations:
> 
> $ ionice -p${pid}
> none: prio 0
> $ ionice -p${pid} -c2 -n4
> $ ionice -p${pid}
> best-effort: prio 4
> $ ionice -p${pid} -c0 -n0
> $ ionice -p${pid}
> best-effort: prio 0
> 
> So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
> directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
> read the docs about ionice in [1].  I notice this code:
> 
> switch (ioprio_class) {
> 	case IOPRIO_CLASS_NONE:
> 		ioprio_class = IOPRIO_CLASS_BE;
>                                ^^^^^^^^^^^^^^^^
>                                *It means that we cannot set back to none.*
> 		break;
> 	case IOPRIO_CLASS_RT:
> 	case IOPRIO_CLASS_BE:
> 		break;
> 	case IOPRIO_CLASS_IDLE:
> 		ioprio = 7;
> 		break;
> 	default:
> 		printf("bad prio class %d\n", ioprio_class);
> 		return 1;
> }
> 
> My question is why we need to ban the user to set back to 'none'.  Is there
> some reasons?  Thank you.

The kernel code does allow it, so it's only in the tool that this
restriction exists. I don't think we have a particularly good reason to
have it there. This is a tools question, though, not a kernel issue. I
suggest you take it up with the util-linux crew. I'm fine with removing
this restriction from ionice, especially since you could just roll your
own that did it.

-- 
Jens Axboe


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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-18 11:48 Why does ionice(1) ban the user to set back to 'none' class? Zheng Liu
  2012-06-18 13:28 ` Jens Axboe
@ 2012-06-18 14:26 ` Rob Landley
  2012-06-19  2:07   ` gnehzuil.lzheng
  1 sibling, 1 reply; 7+ messages in thread
From: Rob Landley @ 2012-06-18 14:26 UTC (permalink / raw)
  To: Jens Axboe, linux-doc, linux-kernel

On 06/18/2012 06:48 AM, Zheng Liu wrote:
> Hi Jens,
> 
> I meet a problem when I use ionice(1) to adjust a process's io priority.
> I do the following operations:
> 
> $ ionice -p${pid}
> none: prio 0
> $ ionice -p${pid} -c2 -n4
> $ ionice -p${pid}
> best-effort: prio 4
> $ ionice -p${pid} -c0 -n0
> $ ionice -p${pid}
> best-effort: prio 0
> 
> So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
> directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
> read the docs about ionice in [1].  I notice this code:
> 
> switch (ioprio_class) {
> 	case IOPRIO_CLASS_NONE:
> 		ioprio_class = IOPRIO_CLASS_BE;
>                                ^^^^^^^^^^^^^^^^
>                                *It means that we cannot set back to none.*
> 		break;
> 	case IOPRIO_CLASS_RT:
> 	case IOPRIO_CLASS_BE:
> 		break;
> 	case IOPRIO_CLASS_IDLE:
> 		ioprio = 7;
> 		break;
> 	default:
> 		printf("bad prio class %d\n", ioprio_class);
> 		return 1;
> }
> 
> My question is why we need to ban the user to set back to 'none'.  Is there
> some reasons?  Thank you.

Since I'm CC'd, I'll explicitly say I haven't a clue why it does this.

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.

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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-18 14:26 ` Rob Landley
@ 2012-06-19  2:07   ` gnehzuil.lzheng
  0 siblings, 0 replies; 7+ messages in thread
From: gnehzuil.lzheng @ 2012-06-19  2:07 UTC (permalink / raw)
  To: Rob Landley; +Cc: Jens Axboe, linux-doc, linux-kernel

On 06/18/2012 10:26 PM, Rob Landley wrote:

> On 06/18/2012 06:48 AM, Zheng Liu wrote:
>> Hi Jens,
>>
>> I meet a problem when I use ionice(1) to adjust a process's io priority.
>> I do the following operations:
>>
>> $ ionice -p${pid}
>> none: prio 0
>> $ ionice -p${pid} -c2 -n4
>> $ ionice -p${pid}
>> best-effort: prio 4
>> $ ionice -p${pid} -c0 -n0
>> $ ionice -p${pid}
>> best-effort: prio 0
>>
>> So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
>> directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
>> read the docs about ionice in [1].  I notice this code:
>>
>> switch (ioprio_class) {
>> 	case IOPRIO_CLASS_NONE:
>> 		ioprio_class = IOPRIO_CLASS_BE;
>>                                ^^^^^^^^^^^^^^^^
>>                                *It means that we cannot set back to none.*
>> 		break;
>> 	case IOPRIO_CLASS_RT:
>> 	case IOPRIO_CLASS_BE:
>> 		break;
>> 	case IOPRIO_CLASS_IDLE:
>> 		ioprio = 7;
>> 		break;
>> 	default:
>> 		printf("bad prio class %d\n", ioprio_class);
>> 		return 1;
>> }
>>
>> My question is why we need to ban the user to set back to 'none'.  Is there
>> some reasons?  Thank you.
> 
> Since I'm CC'd, I'll explicitly say I haven't a clue why it does this.


Thank you all the same. :-)

Regards,
Zheng

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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-18 13:28 ` Jens Axboe
@ 2012-06-19  2:11   ` gnehzuil.lzheng
  2012-06-19  6:40     ` Bernhard Voelker
  0 siblings, 1 reply; 7+ messages in thread
From: gnehzuil.lzheng @ 2012-06-19  2:11 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Rob Landley, linux-doc, linux-kernel, util-linux

[CC'd to util-linux mailing list]

On 06/18/2012 09:28 PM, Jens Axboe wrote:

> On 06/18/2012 01:48 PM, Zheng Liu wrote:
>> Hi Jens,
>>
>> I meet a problem when I use ionice(1) to adjust a process's io priority.
>> I do the following operations:
>>
>> $ ionice -p${pid}
>> none: prio 0
>> $ ionice -p${pid} -c2 -n4
>> $ ionice -p${pid}
>> best-effort: prio 4
>> $ ionice -p${pid} -c0 -n0
>> $ ionice -p${pid}
>> best-effort: prio 0
>>
>> So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
>> directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
>> read the docs about ionice in [1].  I notice this code:
>>
>> switch (ioprio_class) {
>> 	case IOPRIO_CLASS_NONE:
>> 		ioprio_class = IOPRIO_CLASS_BE;
>>                                ^^^^^^^^^^^^^^^^
>>                                *It means that we cannot set back to none.*
>> 		break;
>> 	case IOPRIO_CLASS_RT:
>> 	case IOPRIO_CLASS_BE:
>> 		break;
>> 	case IOPRIO_CLASS_IDLE:
>> 		ioprio = 7;
>> 		break;
>> 	default:
>> 		printf("bad prio class %d\n", ioprio_class);
>> 		return 1;
>> }
>>
>> My question is why we need to ban the user to set back to 'none'.  Is there
>> some reasons?  Thank you.
> 
> The kernel code does allow it, so it's only in the tool that this
> restriction exists. I don't think we have a particularly good reason to
> have it there. This is a tools question, though, not a kernel issue. I
> suggest you take it up with the util-linux crew. I'm fine with removing
> this restriction from ionice, especially since you could just roll your
> own that did it.
> 


Thanks for your reply.  Hopefully we can get some feedbacks from
util-linux crew.

Regards,
Zheng

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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-19  2:11   ` gnehzuil.lzheng
@ 2012-06-19  6:40     ` Bernhard Voelker
  2012-06-19  8:15       ` gnehzuil.lzheng
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Voelker @ 2012-06-19  6:40 UTC (permalink / raw)
  To: gnehzuil.lzheng
  Cc: Jens Axboe, Rob Landley, linux-doc, linux-kernel, util-linux

On 06/19/2012 04:11 AM, gnehzuil.lzheng@gmail.com wrote:
> [CC'd to util-linux mailing list]
> 
> On 06/18/2012 09:28 PM, Jens Axboe wrote:
> 
>> On 06/18/2012 01:48 PM, Zheng Liu wrote:
>>> Hi Jens,
>>>
>>> I meet a problem when I use ionice(1) to adjust a process's io priority.
>>> I do the following operations:
>>>
>>> $ ionice -p${pid}
>>> none: prio 0
>>> $ ionice -p${pid} -c2 -n4
>>> $ ionice -p${pid}
>>> best-effort: prio 4
>>> $ ionice -p${pid} -c0 -n0
>>> $ ionice -p${pid}
>>> best-effort: prio 0
>>>
>>> So I cannot set scheduling class back to 'none'.  If I call ioprio_set(2)
>>> directly, it will be fine.  But if I use ionice(1), I cannot change it.  I
>>> read the docs about ionice in [1].  I notice this code:
>>>
>>> switch (ioprio_class) {
>>> 	case IOPRIO_CLASS_NONE:
>>> 		ioprio_class = IOPRIO_CLASS_BE;
>>>                                ^^^^^^^^^^^^^^^^
>>>                                *It means that we cannot set back to none.*
>>> 		break;
>>> 	case IOPRIO_CLASS_RT:
>>> 	case IOPRIO_CLASS_BE:
>>> 		break;
>>> 	case IOPRIO_CLASS_IDLE:
>>> 		ioprio = 7;
>>> 		break;
>>> 	default:
>>> 		printf("bad prio class %d\n", ioprio_class);
>>> 		return 1;
>>> }
>>>
>>> My question is why we need to ban the user to set back to 'none'.  Is there
>>> some reasons?  Thank you.
>>
>> The kernel code does allow it, so it's only in the tool that this
>> restriction exists. I don't think we have a particularly good reason to
>> have it there. This is a tools question, though, not a kernel issue. I
>> suggest you take it up with the util-linux crew. I'm fine with removing
>> this restriction from ionice, especially since you could just roll your
>> own that did it.
>>
> 
> 
> Thanks for your reply.  Hopefully we can get some feedbacks from
> util-linux crew.

That has already been fixed by commit v2.15-45-g5dc9371 more than 2 years ago:

  Author: Jakob Unterwurzacher <jakobunt@gmail.com>  2009-01-17 02:38:32
  Committer: Karel Zak <kzak@redhat.com>  2009-05-27 23:43:18

and the change made it into 2.16.

The current piece of code looks like this:

	switch (ioclass) {
		case IOPRIO_CLASS_NONE:
			if ((set & 1) && !tolerant)
				warnx(_("ignoring given class data for none class"));
			data = 0;
			break;
		case IOPRIO_CLASS_RT:
		case IOPRIO_CLASS_BE:
			break;

We'are currently at version 2.21.2.

Have a nice day,
Berny




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

* Re: Why does ionice(1) ban the user to set back to 'none' class?
  2012-06-19  6:40     ` Bernhard Voelker
@ 2012-06-19  8:15       ` gnehzuil.lzheng
  0 siblings, 0 replies; 7+ messages in thread
From: gnehzuil.lzheng @ 2012-06-19  8:15 UTC (permalink / raw)
  To: Bernhard Voelker
  Cc: Jens Axboe, Rob Landley, linux-doc, linux-kernel, util-linux

On 06/19/2012 02:40 PM, Bernhard Voelker wrote:

> That has already been fixed by commit v2.15-45-g5dc9371 more than 2 years ago:
> 
>   Author: Jakob Unterwurzacher <jakobunt@gmail.com>  2009-01-17 02:38:32
>   Committer: Karel Zak <kzak@redhat.com>  2009-05-27 23:43:18
> 
> and the change made it into 2.16.
> 
> The current piece of code looks like this:
> 
> 	switch (ioclass) {
> 		case IOPRIO_CLASS_NONE:
> 			if ((set & 1) && !tolerant)
> 				warnx(_("ignoring given class data for none class"));
> 			data = 0;
> 			break;
> 		case IOPRIO_CLASS_RT:
> 		case IOPRIO_CLASS_BE:
> 			break;
> 
> We'are currently at version 2.21.2.

Thanks for pointing out it.  I use ionice(1) in rhel5 and its version is
2.13. :-p

Obviously, Documentation/block/ioprio.txt is out of date.  Later I will
send a patch to fix it.

Regards,
Zheng

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

end of thread, other threads:[~2012-06-19  8:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-18 11:48 Why does ionice(1) ban the user to set back to 'none' class? Zheng Liu
2012-06-18 13:28 ` Jens Axboe
2012-06-19  2:11   ` gnehzuil.lzheng
2012-06-19  6:40     ` Bernhard Voelker
2012-06-19  8:15       ` gnehzuil.lzheng
2012-06-18 14:26 ` Rob Landley
2012-06-19  2:07   ` gnehzuil.lzheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.