Bug 177809

Summary: glibc-headers uses SCHED_OTHER while kernel uses SCHED_NORMAL
Product: [Fedora] Fedora Reporter: Oleg Goldshmidt <pub>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-14 16:09:40 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 Oleg Goldshmidt 2006-01-14 14:50:51 UTC
Description of problem:

The <bits/sched.h> from glibc, and the man pages at least for
sched_{get,set}scheduler(2) use SCHED_OTHER for the default process scheduling
policy. In the kernel (<linux/sched.h> in 2.6.14, 2.6.15 from Fedora updates)
the symbolic name was changed to SCHED_NORMAL. 

This does not cause a real problem yet because in both cases the macro is
expanded to 0. However, it is inconsistent, confusing, and potentially dangerous.

It should be trivial to fix in every single case, but I think RedHat/Fedora
should decide how to approach it system-wide. There may be other apps (e.g.
mozilla) that use SCHED_OTHER as well. I suppose userspace should follow the
kernel on this.

Version-Release number of selected components (on my system):

Fedora Core release 4 (Stentz)
Linux 2.6.15-1.1823_FC4smp x86_64
kernel-2.6.14-1.1656_FC4
kernel-2.6.15-1.1823_FC4
glibc-headers-2.3.5-10.3
man-pages-1.67-8

How reproducible:

Looking at the code and man pages.
 
Steps to Reproduce:
1. grep (or look at) the kernel sources, namely <linux/sched.h> for
SCHED_(OTHER|NORMAL)
2. grep the system headers, namely <bits/sched.h> for same
3. look at (or grep) the relevant man pages (sched_getscheduler(2),
sched_setscheduler(2)) 
  
Actual results:

$ egrep -A2 "^#define[ \t]+SCHED_(OTHER|NORMAL)"
/usr/src/linux-2.6.15/include/linux/sched.h
#define SCHED_NORMAL            0
#define SCHED_FIFO              1
#define SCHED_RR                2
$ egrep -A2 "^#define[ \t]+SCHED_(OTHER|NORMAL)"
/usr/src/linux-2.6.14/include/linux/sched.h
#define SCHED_NORMAL            0
#define SCHED_FIFO              1
#define SCHED_RR                2
$ egrep -A2 "^#define[ \t]+SCHED_(OTHER|NORMAL)" /usr/include/bits/sched.h
#define SCHED_OTHER     0
#define SCHED_FIFO      1
#define SCHED_RR        2
$ man sched_getscheduler | col -b | egrep "SCHED_(OTHER|NORMAL)"
       SCHED_RR, and SCHED_OTHER; their  respective  semantics  are  described
       SCHED_OTHER is the default universal time-sharing scheduler policy used
       uled with SCHED_OTHER must be assigned the static priority 0, processes
       preempt immediately any currently running normal  SCHED_OTHER  process.
   SCHED_OTHER: Default Linux time-sharing scheduling
       SCHED_OTHER  can only be used at static priority 0.  SCHED_OTHER is the
       fair progress among all SCHED_OTHER processes.

Expected results:

SCHED_NORMAL used instead of SCHED_OTHER, consistently with the kernel

Additional info:

I queried the Bugzilla for SCHED_NORMAL in comments, found nothing.

Comment 1 Jakub Jelinek 2006-01-14 16:09:40 UTC
SCHED_OTHER is the name POSIX requires:
http://www.opengroup.org/onlinepubs/009695399/basedefs/sched.h.html
so glibc headers must not change.