Skip to content

Commit

Permalink
sched, treewide: Replace hardcoded nice values with MIN_NICE/MAX_NICE
Browse files Browse the repository at this point in the history
Replace various -20/+19 hardcoded nice values with MIN_NICE/MAX_NICE.

Signed-off-by: Dongsheng Yang <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/ff13819fd09b7a5dba5ab5ae797f2e7019bdfa17.1394532288.git.yangds.fnst@cn.fujitsu.com
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
[ Consolidated the patches, twiddled the changelog. ]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Dongsheng Yang authored and Ingo Molnar committed Apr 18, 2014
1 parent 1044791 commit 8698a74
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ static int loop_thread(void *data)
struct loop_device *lo = data;
struct bio *bio;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

while (!kthread_should_stop() || !bio_list_empty(&lo->lo_bio_list)) {

Expand Down
2 changes: 1 addition & 1 deletion drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ static int nbd_thread(void *data)
struct nbd_device *nbd = data;
struct request *req;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
while (!kthread_should_stop() || !list_empty(&nbd->waiting_queue)) {
/* wait for something to do */
wait_event_interruptible(nbd->waiting_wq,
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ static int kcdrwd(void *foobar)
struct packet_data *pkt;
long min_sleep_time, residue;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
set_freezable();

for (;;) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ static int ipmi_thread(void *data)
struct timespec busy_until;

ipmi_si_set_not_busy(&busy_until);
set_user_nice(current, 19);
set_user_nice(current, MAX_NICE);
while (!kthread_should_stop()) {
int busy_wait;

Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/crypto/ap_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ static int ap_poll_thread(void *data)
int requests;
struct ap_device *ap_dev;

set_user_nice(current, 19);
set_user_nice(current, MAX_NICE);
while (1) {
if (ap_suspend_flag)
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/bnx2fc/bnx2fc_fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static int bnx2fc_l2_rcv_thread(void *arg)
struct fcoe_percpu_s *bg = arg;
struct sk_buff *skb;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
schedule();
Expand Down Expand Up @@ -602,7 +602,7 @@ int bnx2fc_percpu_io_thread(void *arg)
struct bnx2fc_work *work, *tmp;
LIST_HEAD(work_list);

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
schedule();
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/bnx2i/bnx2i_hwi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ int bnx2i_percpu_io_thread(void *arg)
struct bnx2i_work *work, *tmp;
LIST_HEAD(work_list);

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

while (!kthread_should_stop()) {
spin_lock_bh(&p->p_work_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ static int fcoe_percpu_receive_thread(void *arg)

skb_queue_head_init(&tmp);

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

retry:
while (!kthread_should_stop()) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/ibmvscsi/ibmvfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4515,7 +4515,7 @@ static int ibmvfc_work(void *data)
struct ibmvfc_host *vhost = data;
int rc;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

while (1) {
rc = wait_event_interruptible(vhost->work_wait_q,
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/ibmvscsi/ibmvscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ static int ibmvscsi_work(void *data)
struct ibmvscsi_host_data *hostdata = data;
int rc;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

while (1) {
rc = wait_event_interruptible(hostdata->work_wait_q,
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/lpfc/lpfc_hbadisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ lpfc_do_work(void *p)
struct lpfc_hba *phba = p;
int rc;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
current->flags |= PF_NOFREEZE;
phba->data_flags = 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -4828,7 +4828,7 @@ qla2x00_do_dpc(void *data)
ha = (struct qla_hw_data *)data;
base_vha = pci_get_drvdata(ha->pdev);

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ static void binder_set_nice(long nice)
"%d: nice value %ld not allowed use %ld instead\n",
current->pid, nice, min_nice);
set_user_nice(current, min_nice);
if (min_nice < 20)
if (min_nice <= MAX_NICE)
return;
binder_user_error("%d RLIMIT_NICE not set\n", current->pid);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/llite/lloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static int loop_thread(void *data)
int refcheck;
int ret = 0;

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

lo->lo_state = LLOOP_BOUND;

Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/cluster/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ static int o2hb_thread(void *data)

mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread running\n");

set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);

/* Pin node */
o2nm_depend_this_node();
Expand Down
2 changes: 1 addition & 1 deletion kernel/locking/locktorture.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static int lock_torture_writer(void *arg)
static DEFINE_TORTURE_RANDOM(rand);

VERBOSE_TOROUT_STRING("lock_torture_writer task started");
set_user_nice(current, 19);
set_user_nice(current, MAX_NICE);

do {
schedule_timeout_uninterruptible(1);
Expand Down
6 changes: 3 additions & 3 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ enum {

/*
* Rescue workers are used only on emergencies and shared by
* all cpus. Give -20.
* all cpus. Give MIN_NICE.
*/
RESCUER_NICE_LEVEL = -20,
HIGHPRI_NICE_LEVEL = -20,
RESCUER_NICE_LEVEL = MIN_NICE,
HIGHPRI_NICE_LEVEL = MIN_NICE,

WQ_NAME_LEN = 24,
};
Expand Down
2 changes: 1 addition & 1 deletion mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ static int khugepaged(void *none)
struct mm_slot *mm_slot;

set_freezable();
set_user_nice(current, 19);
set_user_nice(current, MAX_NICE);

while (!kthread_should_stop()) {
khugepaged_do_scan();
Expand Down

0 comments on commit 8698a74

Please sign in to comment.