Replace various -20/+19 hardcoded nice values with MIN_NICE/MAX_NICE.
Unified · Split
| @@ -548,7 +548,7 @@ static int loop_thread(void *data) · 547 unmodified lines | |||
| 548 | struct loop_device *lo = data; | 548 | struct loop_device *lo = data; |
| 549 | struct bio *bio; | 549 | struct bio *bio; |
| 550 | 550 | ||
| 551 | set_user_nice(current, -20); | 551 | set_user_nice(current, MIN_NICE); |
| 552 | 552 | ||
| 553 | while (!kthread_should_stop() || !bio_list_empty(&lo->lo_bio_list)) { | 553 | while (!kthread_should_stop() || !bio_list_empty(&lo->lo_bio_list)) { |
| 554 | 554 | ||
| @@ -533,7 +533,7 @@ static int nbd_thread(void *data) · 532 unmodified lines | |||
| 533 | struct nbd_device *nbd = data; | 533 | struct nbd_device *nbd = data; |
| 534 | struct request *req; | 534 | struct request *req; |
| 535 | 535 | ||
| 536 | set_user_nice(current, -20); | 536 | set_user_nice(current, MIN_NICE); |
| 537 | while (!kthread_should_stop() || !list_empty(&nbd->waiting_queue)) { | 537 | while (!kthread_should_stop() || !list_empty(&nbd->waiting_queue)) { |
| 538 | /* wait for something to do */ | 538 | /* wait for something to do */ |
| 539 | wait_event_interruptible(nbd->waiting_wq, | 539 | wait_event_interruptible(nbd->waiting_wq, |
| @@ -1463,7 +1463,7 @@ static int kcdrwd(void *foobar) · 1462 unmodified lines | |||
| 1463 | struct packet_data *pkt; | 1463 | struct packet_data *pkt; |
| 1464 | long min_sleep_time, residue; | 1464 | long min_sleep_time, residue; |
| 1465 | 1465 | ||
| 1466 | set_user_nice(current, -20); | 1466 | set_user_nice(current, MIN_NICE); |
| 1467 | set_freezable(); | 1467 | set_freezable(); |
| 1468 | 1468 | ||
| 1469 | for (;;) { | 1469 | for (;;) { |
| @@ -998,7 +998,7 @@ static int ipmi_thread(void *data) · 997 unmodified lines | |||
| 998 | struct timespec busy_until; | 998 | struct timespec busy_until; |
| 999 | 999 | ||
| 1000 | ipmi_si_set_not_busy(&busy_until); | 1000 | ipmi_si_set_not_busy(&busy_until); |
| 1001 | set_user_nice(current, 19); | 1001 | set_user_nice(current, MAX_NICE); |
| 1002 | while (!kthread_should_stop()) { | 1002 | while (!kthread_should_stop()) { |
| 1003 | int busy_wait; | 1003 | int busy_wait; |
| 1004 | 1004 | ||
| @@ -1803,7 +1803,7 @@ static int ap_poll_thread(void *data) · 1802 unmodified lines | |||
| 1803 | int requests; | 1803 | int requests; |
| 1804 | struct ap_device *ap_dev; | 1804 | struct ap_device *ap_dev; |
| 1805 | 1805 | ||
| 1806 | set_user_nice(current, 19); | 1806 | set_user_nice(current, MAX_NICE); |
| 1807 | while (1) { | 1807 | while (1) { |
| 1808 | if (ap_suspend_flag) | 1808 | if (ap_suspend_flag) |
| 1809 | return 0; | 1809 | return 0; |
| @@ -464,7 +464,7 @@ static int bnx2fc_l2_rcv_thread(void *arg) · 463 unmodified lines | |||
| 464 | struct fcoe_percpu_s *bg = arg; | 464 | struct fcoe_percpu_s *bg = arg; |
| 465 | struct sk_buff *skb; | 465 | struct sk_buff *skb; |
| 466 | 466 | ||
| 467 | set_user_nice(current, -20); | 467 | set_user_nice(current, MIN_NICE); |
| 468 | set_current_state(TASK_INTERRUPTIBLE); | 468 | set_current_state(TASK_INTERRUPTIBLE); |
| 469 | while (!kthread_should_stop()) { | 469 | while (!kthread_should_stop()) { |
| 470 | schedule(); | 470 | schedule(); |
| @@ -602,7 +602,7 @@ int bnx2fc_percpu_io_thread(void *arg) · 131 unmodified lines | |||
| 602 | struct bnx2fc_work *work, *tmp; | 602 | struct bnx2fc_work *work, *tmp; |
| 603 | LIST_HEAD(work_list); | 603 | LIST_HEAD(work_list); |
| 604 | 604 | ||
| 605 | set_user_nice(current, -20); | 605 | set_user_nice(current, MIN_NICE); |
| 606 | set_current_state(TASK_INTERRUPTIBLE); | 606 | set_current_state(TASK_INTERRUPTIBLE); |
| 607 | while (!kthread_should_stop()) { | 607 | while (!kthread_should_stop()) { |
| 608 | schedule(); | 608 | schedule(); |
| @@ -1870,7 +1870,7 @@ int bnx2i_percpu_io_thread(void *arg) · 1869 unmodified lines | |||
| 1870 | struct bnx2i_work *work, *tmp; | 1870 | struct bnx2i_work *work, *tmp; |
| 1871 | LIST_HEAD(work_list); | 1871 | LIST_HEAD(work_list); |
| 1872 | 1872 | ||
| 1873 | set_user_nice(current, -20); | 1873 | set_user_nice(current, MIN_NICE); |
| 1874 | 1874 | ||
| 1875 | while (!kthread_should_stop()) { | 1875 | while (!kthread_should_stop()) { |
| 1876 | spin_lock_bh(&p->p_work_lock); | 1876 | spin_lock_bh(&p->p_work_lock); |
| @@ -1872,7 +1872,7 @@ static int fcoe_percpu_receive_thread(void *arg) · 1871 unmodified lines | |||
| 1872 | 1872 | ||
| 1873 | skb_queue_head_init(&tmp); | 1873 | skb_queue_head_init(&tmp); |
| 1874 | 1874 | ||
| 1875 | set_user_nice(current, -20); | 1875 | set_user_nice(current, MIN_NICE); |
| 1876 | 1876 | ||
| 1877 | retry: | 1877 | retry: |
| 1878 | while (!kthread_should_stop()) { | 1878 | while (!kthread_should_stop()) { |
| @@ -4515,7 +4515,7 @@ static int ibmvfc_work(void *data) · 4514 unmodified lines | |||
| 4515 | struct ibmvfc_host *vhost = data; | 4515 | struct ibmvfc_host *vhost = data; |
| 4516 | int rc; | 4516 | int rc; |
| 4517 | 4517 | ||
| 4518 | set_user_nice(current, -20); | 4518 | set_user_nice(current, MIN_NICE); |
| 4519 | 4519 | ||
| 4520 | while (1) { | 4520 | while (1) { |
| 4521 | rc = wait_event_interruptible(vhost->work_wait_q, | 4521 | rc = wait_event_interruptible(vhost->work_wait_q, |
| @@ -2213,7 +2213,7 @@ static int ibmvscsi_work(void *data) · 2212 unmodified lines | |||
| 2213 | struct ibmvscsi_host_data *hostdata = data; | 2213 | struct ibmvscsi_host_data *hostdata = data; |
| 2214 | int rc; | 2214 | int rc; |
| 2215 | 2215 | ||
| 2216 | set_user_nice(current, -20); | 2216 | set_user_nice(current, MIN_NICE); |
| 2217 | 2217 | ||
| 2218 | while (1) { | 2218 | while (1) { |
| 2219 | rc = wait_event_interruptible(hostdata->work_wait_q, | 2219 | rc = wait_event_interruptible(hostdata->work_wait_q, |
| @@ -731,7 +731,7 @@ lpfc_do_work(void *p) · 730 unmodified lines | |||
| 731 | struct lpfc_hba *phba = p; | 731 | struct lpfc_hba *phba = p; |
| 732 | int rc; | 732 | int rc; |
| 733 | 733 | ||
| 734 | set_user_nice(current, -20); | 734 | set_user_nice(current, MIN_NICE); |
| 735 | current->flags |= PF_NOFREEZE; | 735 | current->flags |= PF_NOFREEZE; |
| 736 | phba->data_flags = 0; | 736 | phba->data_flags = 0; |
| 737 | 737 | ||
| @@ -4828,7 +4828,7 @@ qla2x00_do_dpc(void *data) · 4827 unmodified lines | |||
| 4828 | ha = (struct qla_hw_data *)data; | 4828 | ha = (struct qla_hw_data *)data; |
| 4829 | base_vha = pci_get_drvdata(ha->pdev); | 4829 | base_vha = pci_get_drvdata(ha->pdev); |
| 4830 | 4830 | ||
| 4831 | set_user_nice(current, -20); | 4831 | set_user_nice(current, MIN_NICE); |
| 4832 | 4832 | ||
| 4833 | set_current_state(TASK_INTERRUPTIBLE); | 4833 | set_current_state(TASK_INTERRUPTIBLE); |
| 4834 | while (!kthread_should_stop()) { | 4834 | while (!kthread_should_stop()) { |
| @@ -441,7 +441,7 @@ static void binder_set_nice(long nice) · 440 unmodified lines | |||
| 441 | "%d: nice value %ld not allowed use %ld instead\n", | 441 | "%d: nice value %ld not allowed use %ld instead\n", |
| 442 | current->pid, nice, min_nice); | 442 | current->pid, nice, min_nice); |
| 443 | set_user_nice(current, min_nice); | 443 | set_user_nice(current, min_nice); |
| 444 | if (min_nice < 20) | 444 | if (min_nice <= MAX_NICE) |
| 445 | return; | 445 | return; |
| 446 | binder_user_error("%d RLIMIT_NICE not set\n", current->pid); | 446 | binder_user_error("%d RLIMIT_NICE not set\n", current->pid); |
| 447 | } | 447 | } |
| @@ -407,7 +407,7 @@ static int loop_thread(void *data) · 406 unmodified lines | |||
| 407 | int refcheck; | 407 | int refcheck; |
| 408 | int ret = 0; | 408 | int ret = 0; |
| 409 | 409 | ||
| 410 | set_user_nice(current, -20); | 410 | set_user_nice(current, MIN_NICE); |
| 411 | 411 | ||
| 412 | lo->lo_state = LLOOP_BOUND; | 412 | lo->lo_state = LLOOP_BOUND; |
| 413 | 413 | ||
| @@ -1107,7 +1107,7 @@ static int o2hb_thread(void *data) · 1106 unmodified lines | |||
| 1107 | 1107 | ||
| 1108 | mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread running\n"); | 1108 | mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread running\n"); |
| 1109 | 1109 | ||
| 1110 | set_user_nice(current, -20); | 1110 | set_user_nice(current, MIN_NICE); |
| 1111 | 1111 | ||
| 1112 | /* Pin node */ | 1112 | /* Pin node */ |
| 1113 | o2nm_depend_this_node(); | 1113 | o2nm_depend_this_node(); |
| @@ -216,7 +216,7 @@ static int lock_torture_writer(void *arg) · 215 unmodified lines | |||
| 216 | static DEFINE_TORTURE_RANDOM(rand); | 216 | static DEFINE_TORTURE_RANDOM(rand); |
| 217 | 217 | ||
| 218 | VERBOSE_TOROUT_STRING("lock_torture_writer task started"); | 218 | VERBOSE_TOROUT_STRING("lock_torture_writer task started"); |
| 219 | set_user_nice(current, 19); | 219 | set_user_nice(current, MAX_NICE); |
| 220 | 220 | ||
| 221 | do { | 221 | do { |
| 222 | schedule_timeout_uninterruptible(1); | 222 | schedule_timeout_uninterruptible(1); |
| @@ -100,10 +100,10 @@ enum { · 99 unmodified lines | |||
| 100 | 100 | ||
| 101 | /* | 101 | /* |
| 102 | * Rescue workers are used only on emergencies and shared by | 102 | * Rescue workers are used only on emergencies and shared by |
| 103 | * all cpus. Give -20. | 103 | * all cpus. Give MIN_NICE. |
| 104 | */ | 104 | */ |
| 105 | RESCUER_NICE_LEVEL = -20, | 105 | RESCUER_NICE_LEVEL = MIN_NICE, |
| 106 | HIGHPRI_NICE_LEVEL = -20, | 106 | HIGHPRI_NICE_LEVEL = MIN_NICE, |
| 107 | 107 | ||
| 108 | WQ_NAME_LEN = 24, | 108 | WQ_NAME_LEN = 24, |
| 109 | }; | 109 | }; |
| @@ -2803,7 +2803,7 @@ static int khugepaged(void *none) · 2802 unmodified lines | |||
| 2803 | struct mm_slot *mm_slot; | 2803 | struct mm_slot *mm_slot; |
| 2804 | 2804 | ||
| 2805 | set_freezable(); | 2805 | set_freezable(); |
| 2806 | set_user_nice(current, 19); | 2806 | set_user_nice(current, MAX_NICE); |
| 2807 | 2807 | ||
| 2808 | while (!kthread_should_stop()) { | 2808 | while (!kthread_should_stop()) { |
| 2809 | khugepaged_do_scan(); | 2809 | khugepaged_do_scan(); |