Bug 721416

Summary: nice command is ignored - cannot prioritize tasks
Product: [Fedora] Fedora Reporter: Witek Mozga <mozga>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: Bert.Deknuydt, dennis, gansalmon, itamar, jonathan, j, kernel-maint, kthawan, madhu.chinakonda, robatino, scottro11
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-28 19:26:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Witek Mozga 2011-07-14 14:23:23 UTC
Description of problem: nice command is ignored. I can see via the top command that two similar processes are using exactly the same CPU although their niceness is quite different (-1 vs. 19)


How reproducible:
try to prioritize two CPU-consuming tasks with nice or renice

Comment 1 Bill Nottingham 2011-07-14 17:23:08 UTC
The kernel interprets scheduling priority, assigning there.

Comment 2 Scott Robbins 2011-07-14 18:54:31 UTC
If the nice command is no longer being used, it should probably get into the common bugs and/or release notes.  (And the man pages for nice.)

However, I'm not quite sure I understand.  Is that what Bill's comment means?

Is this Fedora only, or is this the case in all versions of Linux using later kernels?

Comment 3 Witek Mozga 2011-07-14 19:19:55 UTC
I tested only Fedora and Salix (a kind of Slackware) and the latter works as expected, however it comes with kernel 2.6.37.6

Comment 4 Witek Mozga 2011-10-06 12:20:51 UTC
I`ve just tested on latest Fedora 16 Beta that nice is still ignored

Comment 5 Chuck Ebbert 2011-11-29 02:19:12 UTC
Works perfectly for me on Fedora 15. The niced task uses 10% and the normal one uses 90% of one CPU.

Do you have multiple processors in that machine? If so, one task will run on each CPU and nice will not really have any effect. (I used taskset to force both onto one processor for testing.)

Comment 6 Witek Mozga 2011-11-29 08:31:29 UTC
I don`t have multiple processors. By the way if you start processes from one terminal 'nice' might work as expected but otherwise not.
http://forums.fedoraforum.org/showthread.php?t=266839&page=2

Comment 7 Chuck Ebbert 2011-12-06 20:05:41 UTC
Sigh. This is almost certainly being caused by the cgroup autosched patch. (The same miracle patch that everyone clamored for because it helped with desktop interactivity.)

Comment 8 Jason Tibbitts 2011-12-06 20:35:55 UTC
You should definitely disable sched_autogroup on computational servers and basically anywhere else you want to be able to use 'nice' usefully.

echo "kernel.sched_autogroup_enabled = 0" >> /etc/sysctl.conf
sysctl -p

Comment 9 Chuck Ebbert 2011-12-06 20:46:34 UTC
You can also boot with the "noautogroup" kernel option to disable them. (Note that this really has nothing to do with systemd using cgroups to isolate things.)

More interesting, you can renice the autogroups just like tasks:

[cebbert@damacy /]$ cd /proc/9872
[cebbert@damacy 9872]$ cat autogroup
/autogroup-199 nice 0
[cebbert@damacy 9872]$ echo -1 >autogroup
bash: echo: write error: Operation not permitted
[cebbert@damacy 9872]$ echo 19 >autogroup
[cebbert@damacy 9872]$ cat autogroup
/autogroup-199 nice 19

Comment 10 Thawan Kooburat 2011-12-18 01:53:33 UTC
*** Bug 747488 has been marked as a duplicate of this bug. ***

Comment 11 Josh Boyer 2012-02-28 19:26:23 UTC
This seems to be working as designed when taking sched_autogroup into account.  There's really not much to fix here.  Since there is a known workaround, we can close this out.