Bug 125187 - Use of setpriority(2) only allows _increasing_ priorities
Use of setpriority(2) only allows _increasing_ priorities
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-03 10:49 EDT by Stewart Wright
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-06-19 08:03:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Code to renice a process (1.17 KB, text/plain)
2004-06-03 10:50 EDT, Stewart Wright
no flags Details

  None (edit)
Description Stewart Wright 2004-06-03 10:49:26 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
(Apologies for putting this in coreutils, I'm not exactly sure where
this goes as it relates (I think) to my renice bug.)

Core using setpriority(2) only allows an increase in priority, rather
than a decrease.

Using a line like 
   res = setpriority(PRIO_PROCESS, pid, prio);
will result in a failure if prio is smaller than the current priority
of pid.  Increasing the priority returns success.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Compile attached reniceit.c
2. Select process (Mozilla for example) and get PID
3. Run:
    reniceit PID 4
4. Run:
    reniceit PID 3
    

Actual Results:  > reniceit 983 4
Process 983 has priority 0
Renicing process 983 to priority 4
Return value is : 0
Process 983 has priority 4

> reniceit 983 3
Process 983 has priority 4
Renicing process 983 to priority 3
Return value is : -1
Process 983 has priority 4


Expected Results:  Process should change priority.

Additional info:

I think this is an indication of the problems in using both the renice
command and top to renice processes.

As to the cause ?????
Comment 1 Stewart Wright 2004-06-03 10:50:59 EDT
Created attachment 100832 [details]
Code to renice a process

This code is a simple example of how setpriority(2) will fail.
Comment 2 Alan Cox 2004-06-19 08:03:53 EDT
Lower numbers are higher priority. See man 2 setpriority.

Note You need to log in before you can comment on or make changes to this bug.