Re: Why does ionice(1) ban the user to set back to 'none' class?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux