public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Q] change_parent() - would this work?
@ 2002-06-22 10:36 Thunder from the hill
  2002-06-25  9:24 ` Brad Heilbrun
  0 siblings, 1 reply; 2+ messages in thread
From: Thunder from the hill @ 2002-06-22 10:36 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi,

My question is: would this work?

Index: thunder-2.5/include/linux/sched.h
===================================================================
RCS file: thunder-2.5/include/linux/sched.h,v
retrieving revision 1.2
diff -u -r1.2 thunder-2.5/include/linux/sched.h
--- thunder-2.5/include/linux/sched.h	22 Jun 2002 01:51:33 -0000	1.2
+++ thunder-2.5/include/linux/sched.h	22 Jun 2002 10:33:57 -0000
@@ -716,6 +716,7 @@
 
 #define remove_parent(p)	list_del_init(&(p)->sibling)
 #define add_parent(p, parent)	list_add_tail(&(p)->sibling,&(parent)->children)
+#define change_parent(p)	list_move_tail(&(p)->sibling,&(parent)->children)
 
 #define REMOVE_LINKS(p) do {				\
 	list_del_init(&(p)->tasks);			\
Index: thunder-2.5/kernel/exit.c
===================================================================
RCS file: thunder-2.5/kernel/exit.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 thunder-2.5/kernel/exit.c
--- thunder-2.5/kernel/exit.c	20 Jun 2002 22:53:49 -0000	1.1.1.1
+++ thunder-2.5/kernel/exit.c	22 Jun 2002 10:33:57 -0000
@@ -636,8 +636,7 @@
 
 				/* move to end of parent's list to avoid starvation */
 				write_lock_irq(&tasklist_lock);
-				remove_parent(p);
-				add_parent(p, p->parent);
+				change_parent(p, p->parent);
 				write_unlock_irq(&tasklist_lock);
 				retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; 
 				if (!retval && stat_addr) 

							Regards,
							Thunder
--
"You must cut down the mighties tree in the forest with - a herring!"
					-- chief of the knights who to
					   recently said "NIH"


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

* Re: [Q] change_parent() - would this work?
  2002-06-22 10:36 [Q] change_parent() - would this work? Thunder from the hill
@ 2002-06-25  9:24 ` Brad Heilbrun
  0 siblings, 0 replies; 2+ messages in thread
From: Brad Heilbrun @ 2002-06-25  9:24 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Linux Kernel Mailing List

On Sat, Jun 22, 2002 at 04:36:53AM -0600, Thunder from the hill wrote:
> Hi,
> 
> My question is: would this work?

I don't believe so...

> +#define change_parent(p)	list_move_tail(&(p)->sibling,&(parent)->children)

On the above line change_parent takes one argument.

> +				change_parent(p, p->parent);

Here, it takes two.

Otherwise it looks good, and removes a couple of assignments. Not sure
how useful it is though, is this done a lot?

-- 
Brad Heilbrun

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

end of thread, other threads:[~2002-06-25  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-22 10:36 [Q] change_parent() - would this work? Thunder from the hill
2002-06-25  9:24 ` Brad Heilbrun

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