[PATCH v4 11/12] sched/numa: drop unnecessary variable in task_weight

From: Wanpeng Li
Date: Tue Dec 10 2013 - 04:27:42 EST


Drop unnecessary total_faults variable in function task_weight to unify
task_weight and group_weight.

Reviewed-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
Signed-off-by: Wanpeng Li <liwanp@xxxxxxxxxxxxxxxxxx>
---
kernel/sched/fair.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d51b8c3..5ff86ec 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -947,17 +947,10 @@ static inline unsigned long group_faults(struct task_struct *p, int nid)
*/
static inline unsigned long task_weight(struct task_struct *p, int nid)
{
- unsigned long total_faults;
-
- if (!p->numa_faults)
- return 0;
-
- total_faults = p->total_numa_faults;
-
- if (!total_faults)
+ if (!p->numa_faults || !p->total_numa_faults)
return 0;

- return 1000 * task_faults(p, nid) / total_faults;
+ return 1000 * task_faults(p, nid) / p->total_numa_faults;
}

static inline unsigned long group_weight(struct task_struct *p, int nid)
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/