Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2008 08:31:06 GMT
From:      Unga <unga888@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/129164: Wrong priority value for normal processes
Message-ID:  <200811250831.mAP8V6cP064024@www.freebsd.org>
Resent-Message-ID: <200811250840.mAP8e5Qb041532@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         129164
>Category:       kern
>Synopsis:       Wrong priority value for normal processes
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 25 08:40:05 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Unga
>Release:        FreeBSD 7.0-STABLE
>Organization:
>Environment:
FreeBSD grey.lan 7.0-STABLE FreeBSD 7.0-STABLE Sun May 25 2008 i386
>Description:
The priority value for root and other normal processes is 65504 (rtp.prio) where zero (0) is expected.

I checked the program flow from /usr/src/usr.bin/su/su.c to /usr/src/lib/libutil/login_class.c and it looks setusercontext() is setting the priority zero (0) right but the moment it come out from the setusercontext() call in su.c, the priority has already turn to 65504.

I have marked this issue as "serious". It is serious because normal priority processes crawl on my machine.

Maximum priority value for normal priority processes can take is 20, not 65504. Normal priority processes are expected to run at priority zero (0) as it is specified in /etc/login.conf under login class "default". 


>How-To-Repeat:
Compile and run the following program:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/rtprio.h>

main(int argc, char * argv[])
{
 struct rtprio rtp;

 if (rtprio(RTP_LOOKUP, 0, &rtp))
    {
     printf("Cannot get priority!\n");
     exit(-1);
    }

printf("Priority %d\n", rtp.prio);
}

The priority class can be obtained by running rtprio. 
>Fix:
I find it bit difficult to understand why the priority value get changed as I explained under Full Description. If somebody could help me to find where the problem is, I could possibly be able to develop a patch. 

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811250831.mAP8V6cP064024>