diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2008-07-25 04:47:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:38 -0400 |
commit | 02412483777651a26b19a75e49c2a451a174ca9c (patch) | |
tree | 2289c80253b5e6be9b3fe3635e919bbe7a3bd03d /kernel | |
parent | 489a5393a20dcbf91104052120eb2eff8791b61b (diff) |
cpuset: code-cleanup for started_after
cgroup(cgroup_scan_tasks) will initialize heap->gt for us. This patch
removes started_after() and its helper-function.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 531b235e546f..ebbc9b082e48 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -709,36 +709,6 @@ done: | |||
709 | /* Don't kfree(dattr) -- partition_sched_domains() does that. */ | 709 | /* Don't kfree(dattr) -- partition_sched_domains() does that. */ |
710 | } | 710 | } |
711 | 711 | ||
712 | static inline int started_after_time(struct task_struct *t1, | ||
713 | struct timespec *time, | ||
714 | struct task_struct *t2) | ||
715 | { | ||
716 | int start_diff = timespec_compare(&t1->start_time, time); | ||
717 | if (start_diff > 0) { | ||
718 | return 1; | ||
719 | } else if (start_diff < 0) { | ||
720 | return 0; | ||
721 | } else { | ||
722 | /* | ||
723 | * Arbitrarily, if two processes started at the same | ||
724 | * time, we'll say that the lower pointer value | ||
725 | * started first. Note that t2 may have exited by now | ||
726 | * so this may not be a valid pointer any longer, but | ||
727 | * that's fine - it still serves to distinguish | ||
728 | * between two tasks started (effectively) | ||
729 | * simultaneously. | ||
730 | */ | ||
731 | return t1 > t2; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | static inline int started_after(void *p1, void *p2) | ||
736 | { | ||
737 | struct task_struct *t1 = p1; | ||
738 | struct task_struct *t2 = p2; | ||
739 | return started_after_time(t1, &t2->start_time, t2); | ||
740 | } | ||
741 | |||
742 | /** | 712 | /** |
743 | * cpuset_test_cpumask - test a task's cpus_allowed versus its cpuset's | 713 | * cpuset_test_cpumask - test a task's cpus_allowed versus its cpuset's |
744 | * @tsk: task to test | 714 | * @tsk: task to test |
@@ -790,7 +760,12 @@ static int update_tasks_cpumask(struct cpuset *cs) | |||
790 | struct ptr_heap heap; | 760 | struct ptr_heap heap; |
791 | int retval; | 761 | int retval; |
792 | 762 | ||
793 | retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, &started_after); | 763 | /* |
764 | * cgroup_scan_tasks() will initialize heap->gt for us. | ||
765 | * heap_init() is still needed here for we should not change | ||
766 | * cs->cpus_allowed when heap_init() fails. | ||
767 | */ | ||
768 | retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL); | ||
794 | if (retval) | 769 | if (retval) |
795 | return retval; | 770 | return retval; |
796 | 771 | ||