Skip to content

Commit f05998d

Browse files
Nikhil RaoIngo Molnar
Nikhil Rao
authored and
Ingo Molnar
committed
sched: Cleanup set_load_weight()
Avoid using long repetitious names; make this simpler and nicer to read. No functional change introduced in this patch. Signed-off-by: Nikhil Rao <ncrao@google.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com> Cc: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> Cc: Stephan Barwolf <stephan.baerwolf@tu-ilmenau.de> Cc: Mike Galbraith <efault@gmx.de> Link: http://lkml.kernel.org/r/1305738580-9924-2-git-send-email-ncrao@google.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 257313b commit f05998d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

kernel/sched.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -1778,17 +1778,20 @@ static void dec_nr_running(struct rq *rq)
17781778

17791779
static void set_load_weight(struct task_struct *p)
17801780
{
1781+
int prio = p->static_prio - MAX_RT_PRIO;
1782+
struct load_weight *load = &p->se.load;
1783+
17811784
/*
17821785
* SCHED_IDLE tasks get minimal weight:
17831786
*/
17841787
if (p->policy == SCHED_IDLE) {
1785-
p->se.load.weight = WEIGHT_IDLEPRIO;
1786-
p->se.load.inv_weight = WMULT_IDLEPRIO;
1788+
load->weight = WEIGHT_IDLEPRIO;
1789+
load->inv_weight = WMULT_IDLEPRIO;
17871790
return;
17881791
}
17891792

1790-
p->se.load.weight = prio_to_weight[p->static_prio - MAX_RT_PRIO];
1791-
p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO];
1793+
load->weight = prio_to_weight[prio];
1794+
load->inv_weight = prio_to_wmult[prio];
17921795
}
17931796

17941797
static void enqueue_task(struct rq *rq, struct task_struct *p, int flags)

0 commit comments

Comments
 (0)