public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] cpuset: code-cleanup for started_after
@ 2008-07-16  3:43 Lai Jiangshan
  2008-07-16  7:17 ` Paul Menage
  0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2008-07-16  3:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Paul Jackson, Paul Menage, Linux Kernel Mailing List

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>
---
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 798b3ab..aaec03a 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -701,36 +701,6 @@ done:
 	/* Don't kfree(dattr) -- partition_sched_domains() does that. */
 }
 
-static inline int started_after_time(struct task_struct *t1,
-				     struct timespec *time,
-				     struct task_struct *t2)
-{
-	int start_diff = timespec_compare(&t1->start_time, time);
-	if (start_diff > 0) {
-		return 1;
-	} else if (start_diff < 0) {
-		return 0;
-	} else {
-		/*
-		 * Arbitrarily, if two processes started at the same
-		 * time, we'll say that the lower pointer value
-		 * started first. Note that t2 may have exited by now
-		 * so this may not be a valid pointer any longer, but
-		 * that's fine - it still serves to distinguish
-		 * between two tasks started (effectively)
-		 * simultaneously.
-		 */
-		return t1 > t2;
-	}
-}
-
-static inline int started_after(void *p1, void *p2)
-{
-	struct task_struct *t1 = p1;
-	struct task_struct *t2 = p2;
-	return started_after_time(t1, &t2->start_time, t2);
-}
-
 /**
  * cpuset_test_cpumask - test a task's cpus_allowed versus its cpuset's
  * @tsk: task to test
@@ -809,7 +779,12 @@ static int update_cpumask(struct cpuset *cs, char *buf)
 	if (cpus_equal(cs->cpus_allowed, trialcs.cpus_allowed))
 		return 0;
 
-	retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, &started_after);
+	/*
+	 * cgroup_scan_tasks() will initialize heap->gt for us.
+	 * heap_init() is still needed here for we should not change
+	 * cs->cpus_allowed when heap_init() fails.
+	 */
+	retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL);
 	if (retval)
 		return retval;
 






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] cpuset: code-cleanup for started_after
  2008-07-16  3:43 [PATCH 2/3] cpuset: code-cleanup for started_after Lai Jiangshan
@ 2008-07-16  7:17 ` Paul Menage
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Menage @ 2008-07-16  7:17 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Andrew Morton, Paul Jackson, Linux Kernel Mailing List

On Tue, Jul 15, 2008 at 8:43 PM, Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
> 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>

Looks good, thanks.

Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-16  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16  3:43 [PATCH 2/3] cpuset: code-cleanup for started_after Lai Jiangshan
2008-07-16  7:17 ` Paul Menage

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox