All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix off-by-one in __iterator_load_balance
@ 2009-03-11 14:49 David Newall
  2009-03-12  9:34 ` David Newall
  0 siblings, 1 reply; 3+ messages in thread
From: David Newall @ 2009-03-11 14:49 UTC (permalink / raw)
  To: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

An off-by-one bug in __iterator_load_balance causes it to erroneously
return NULL if the next task on the list is also the last entry in the
list.  This patch corrects that fault.

[-- Attachment #2: sched_fair.patch --]
[-- Type: text/x-patch, Size: 908 bytes --]

--- sched_fair.c	2009-02-21 09:09:34.000000000 +1030
+++ sched_fair.c.dn	2009-03-12 01:09:46.000000000 +1030
@@ -1439,27 +1439,18 @@
 static struct task_struct *
 __load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next)
 {
-	struct task_struct *p = NULL;
 	struct sched_entity *se;
-
-	if (next == &cfs_rq->tasks)
-		return NULL;
-
-	/* Skip over entities that are not tasks */
-	do {
+	while (next != &cfs_rq->tasks)
+	{
 		se = list_entry(next, struct sched_entity, group_node);
 		next = next->next;
-	} while (next != &cfs_rq->tasks && !entity_is_task(se));
-
-	if (next == &cfs_rq->tasks)
-		return NULL;
-
-	cfs_rq->balance_iterator = next;
-
-	if (entity_is_task(se))
-		p = task_of(se);
-
-	return p;
+		if (entity_is_task(se))
+		{
+			cfs_rq->balance_iterator = next;
+			return task_of(se);
+		}
+	}
+	return NULL;
 }
 
 static struct task_struct *load_balance_start_fair(void *arg)

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

* Re: [PATCH] fix off-by-one in __iterator_load_balance
  2009-03-11 14:49 [PATCH] fix off-by-one in __iterator_load_balance David Newall
@ 2009-03-12  9:34 ` David Newall
  2009-03-12 10:02   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: David Newall @ 2009-03-12  9:34 UTC (permalink / raw)
  To: Linux Kernel Mailing List

David Newall wrote:
> An off-by-one bug in __iterator_load_balance causes it to erroneously
> return NULL if the next task on the list is also the last entry in the
> list.  This patch corrects that fault.
>   

Patch withdrawn.  Who'd have thought 2.6.27.19 was so out of date?

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

* Re: [PATCH] fix off-by-one in __iterator_load_balance
  2009-03-12  9:34 ` David Newall
@ 2009-03-12 10:02   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-03-12 10:02 UTC (permalink / raw)
  To: David Newall; +Cc: Linux Kernel Mailing List, Andrew Morton


* David Newall <davidn@davidnewall.com> wrote:

> David Newall wrote:
> > An off-by-one bug in __iterator_load_balance causes it to erroneously
> > return NULL if the next task on the list is also the last entry in the
> > list.  This patch corrects that fault.
> >   
> 
> Patch withdrawn.  Who'd have thought 2.6.27.19 was so out of date?

Yeah, the 2.6.27 -> latest-sched-devel distance is more than 250 
commits already - that's a lot of commits for the scheduler 
which is only 15 KLOC. Patches done on .27 are unlikely to apply 
- and bugs are often fixed already.

	Ingo

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

end of thread, other threads:[~2009-03-12 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-11 14:49 [PATCH] fix off-by-one in __iterator_load_balance David Newall
2009-03-12  9:34 ` David Newall
2009-03-12 10:02   ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.