Subject: Re: bug#11437: coreutils: Please disable misc/nice test on hurd-i386]

From: Eric Blake <[email-masked]>
Date: Tue, 08 May 2012 12:54:08 -0600

On 05/08/2012 12:39 PM, Samuel Thibault wrote:
> (From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670477 )
> 
> Hello,
> 
> The misc/nice test currently fails on hurd-i386 because the nice support
> there is not precise enough: the Mach kernel, which handles scheduling
> priorities, has only 32 priority levels, and not 40, so conversion is
> used, but that becomes not precise enough for the misc/nice test.  Apart
> from that, the nice tool works fine. Could you disable that test on
> hurd-i386?

What is the mapping between the kernel's 32 levels and the
POSIX-mandated minimum of 40 niceness levels (that is, which niceness
levels are rounded to a neighbor)?  Can we rewrite the test to use just
niceness levels provided by Hurd?  Would it be any simpler if Hurd were
to define NZERO as 32, and provide only even niceness values?  In fact,
if you could track 64 niceness levels, and just have every pair of
niceness levels map to the kernel priorities, then you would be
POSIX-compliant (POSIX doesn't require that niceness level 0 and 1 have
any difference in scheduling, only that you can have niceness levels
between 0 and 2*NZERO-1).

In other words, I'm proposing:

NZERO=32

Niceness    Kernel priority
-32         0
-31         0
-30         1
-29         1
...
0           16
1           16
2           17
...
29          30
30          31
31          31

(assuming kernel priority is like niceness, where a lower number is
higher priority)

If you make that fix to Hurd, then the mapping will just work, and
coreutils will start passing the test.

-- 
Eric Blake   [email-masked]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org