mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] 2.5.63 tsk->usage count.
@ 2003-02-28  9:24 Martin Schwidefsky
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Schwidefsky @ 2003-02-28  9:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel


> This actually looks wrong, it ends up doing free_user() twice because a
> final put_task_struct() does that too these days.
>
> Does this alternate patch work for you instead?

Works fine. I had a "Badness in __put_task_struct at kernel/fork.c:77"
from time to time. I couldn't reproduce this with your patch.

blue skies,
   Martin



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] 2.5.63 tsk->usage count.
@ 2003-02-27 10:34 Martin Schwidefsky
  2003-02-28  6:58 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Schwidefsky @ 2003-02-27 10:34 UTC (permalink / raw)
  To: linux-kernel, torvalds

Hi Linus,
while debugging a memory leak with task structures on s390
I found something related to it. If copy_process fails for some
reason the task structure created with dup_task_struct has set
p->usage to 2 but only one put_task_struct is done in the error
cleanup code. The attached patch should take care of it.

blue skies,
  Martin.

diff -urN linux-2.5/kernel/fork.c linux-2.5-fork/kernel/fork.c
--- linux-2.5/kernel/fork.c	Thu Feb 27 11:25:56 2003
+++ linux-2.5-fork/kernel/fork.c	Thu Feb 27 10:11:42 2003
@@ -1034,6 +1034,8 @@
 	atomic_dec(&p->user->processes);
 	free_uid(p->user);
 bad_fork_free:
+	/* dup_task_struct sets p->usage to 2 */
+	atomic_dec(&p->usage);
 	put_task_struct(p);
 	goto fork_out;
 }


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

end of thread, other threads:[~2003-02-28  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-28  9:24 [PATCH] 2.5.63 tsk->usage count Martin Schwidefsky
  -- strict thread matches above, loose matches on Subject: below --
2003-02-27 10:34 Martin Schwidefsky
2003-02-28  6:58 ` Linus Torvalds

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

all inboxes | Powered by JetHome®