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/19/2012 04:11 AM, gnehzuil.lzheng@xxxxxxxxx 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@xxxxxxxxx>  2009-01-17 02:38:32
  Committer: Karel Zak <kzak@xxxxxxxxxx>  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



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


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Kbuild]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]