From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: rusty@rustcorp.com.au, paulus@au1.ibm.com, nathanl@austin.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: [BUG] mm_struct leak on cpu hotplug (s390/ppc64)
Date: Tue, 4 Jan 2005 14:11:01 +0100 [thread overview]
Message-ID: <20050104131101.GA3560@osiris.boeblingen.de.ibm.com> (raw)
Hi,
there is an mm_struct memory leak when using cpu hotplug. Appearently
start_secondary in smp.c initializes active_mm of the cpu's idle task
and increases init_mm's mm_count. But on cpu_die the idle task's
active_mm doesn't get dropped and therefore on the next cpu_up event
(->start_secondary) it gets overwritten and the result is a forgotten
reference count to whatever mm_struct was active when the cpu
was taken down previously.
The patch below should fix this for s390 (at least it works fine for
me), but I'm not sure if it's ok to call mmdrop from __cpu_die.
Also this very same leak exists for ppc64 as well.
Any opinions?
Thanks,
Heiko
diff -urN linux-2.6.10/arch/s390/kernel/smp.c linux-2.6.10-patched/arch/s390/kernel/smp.c
--- linux-2.6.10/arch/s390/kernel/smp.c 2004-12-24 22:35:50.000000000 +0100
+++ linux-2.6.10-patched/arch/s390/kernel/smp.c 2005-01-04 13:42:14.000000000 +0100
@@ -728,9 +728,14 @@
void
__cpu_die(unsigned int cpu)
{
+ struct task_struct *p;
+
/* Wait until target cpu is down */
while (!cpu_stopped(cpu));
printk("Processor %d spun down\n", cpu);
+ p = current_set[cpu];
+ mmdrop(p->active_mm);
+ p->active_mm = NULL;
}
void
next reply other threads:[~2005-01-04 13:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-04 13:11 Heiko Carstens [this message]
2005-01-05 2:41 ` [BUG] mm_struct leak on cpu hotplug (s390/ppc64) Nathan Lynch
2005-01-05 11:08 ` Ingo Molnar
2005-01-05 14:22 ` Heiko Carstens
2005-01-05 15:44 ` Nathan Lynch
2005-01-07 11:43 ` Ingo Molnar
2005-01-07 21:43 ` [PATCH] introduce idle_task_exit Nathan Lynch
2005-01-07 21:44 ` [PATCH] ppc64: call idle_task_exit from cpu_die Nathan Lynch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050104131101.GA3560@osiris.boeblingen.de.ibm.com \
--to=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathanl@austin.ibm.com \
--cc=paulus@au1.ibm.com \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox