* [Linux-ia64] Memory leak in 2.5.64
@ 2003-03-11 3:44 Peter Chubb
2003-03-12 6:55 ` David Mosberger
0 siblings, 1 reply; 2+ messages in thread
From: Peter Chubb @ 2003-03-11 3:44 UTC (permalink / raw)
To: linux-ia64
Hi David,
The way that tasks need to be freed has changed since 2.5.61 --- I
think we need to do something like the attached patch (keep
__put_task_struct() in kernel/fork.c; have ia64-specific
free_task_struct() in arch/ia64/kernel/process.c)
otherwise the user_struct will never have its reference count deleted
and so will not be freed.
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.5.64-davidm/arch/ia64/kernel/process.c linux-2.5-EXPORT/arch/ia64/kernel/process.c
--- linux-2.5.64-davidm/arch/ia64/kernel/process.c Mon Mar 10 19:27:27 2003
+++ linux-2.5-EXPORT/arch/ia64/kernel/process.c Tue Mar 11 11:03:25 2003
@@ -751,7 +751,7 @@
}
void
-__put_task_struct (struct task_struct *tsk)
+free_task_struct(struct task_struct *tsk)
{
- free_pages((unsigned long) tsk, KERNEL_STACK_SIZE_ORDER);
+ free_pages((unsigned long)tsk, KERNEL_STACK_SIZE_ORDER);
}
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.5.64-davidm/kernel/fork.c linux-2.5-EXPORT/kernel/fork.c
--- linux-2.5.64-davidm/kernel/fork.c Mon Mar 10 19:28:27 2003
+++ linux-2.5-EXPORT/kernel/fork.c Tue Mar 11 10:38:37 2003
@@ -38,7 +38,9 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
+#ifndef CONFIG_IA64
static kmem_cache_t *task_struct_cachep;
+#endif
extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
extern void exit_semundo(struct task_struct *tsk);
@@ -53,13 +55,6 @@
rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED; /* outer */
-/*
- * A per-CPU task cache - this relies on the fact that
- * the very last portion of sys_exit() is executed with
- * preemption turned off.
- */
-static task_t *task_cache[NR_CPUS] __cacheline_aligned;
-
int nr_processes(void)
{
int cpu;
@@ -72,6 +67,14 @@
return total;
}
+#ifndef CONFIG_IA64
+/*
+ * A per-CPU task cache - this relies on the fact that
+ * the very last portion of sys_exit() is executed with
+ * preemption turned off.
+ */
+task_t *task_cache[NR_CPUS] __cacheline_aligned;
+
static void free_task_struct(struct task_struct *tsk)
{
/*
@@ -95,8 +98,10 @@
put_cpu();
}
}
+#else
+extern void free_task_struct(struct task_struct *tsk);
+#endif
-#if 0
void __put_task_struct(struct task_struct *tsk)
{
WARN_ON(!(tsk->state & (TASK_DEAD | TASK_ZOMBIE)));
@@ -107,7 +112,6 @@
free_uid(tsk->user);
free_task_struct(tsk);
}
-#endif
void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
{
@@ -187,13 +191,14 @@
void __init fork_init(unsigned long mempages)
{
/* create a slab on which task_structs can be allocated */
+#ifndef CONFIG_IA64
task_struct_cachep kmem_cache_create("task_struct",
sizeof(struct task_struct),0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!task_struct_cachep)
panic("fork_init(): cannot create task_struct SLAB cache");
-
+#endif
/*
* The default maximum number of threads is set to a safe
* value: the thread structures can take up at most half
@@ -210,7 +215,7 @@
init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
}
-#if 1
+#ifdef CONFIG_IA64
extern struct task_struct *dup_task_struct (struct task_struct *orig);
#else
@@ -247,7 +252,6 @@
}
#endif
-
#ifdef CONFIG_MMU
static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
{
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Linux-ia64] Memory leak in 2.5.64
2003-03-11 3:44 [Linux-ia64] Memory leak in 2.5.64 Peter Chubb
@ 2003-03-12 6:55 ` David Mosberger
0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2003-03-12 6:55 UTC (permalink / raw)
To: linux-ia64
>>>>> On Mon, 10 Mar 2003 19:59:39 -0800, William Lee Irwin III <wli@holomorphy.com> said:
William> On Tue, Mar 11, 2003 at 02:44:14PM +1100, Peter Chubb
William> wrote:
>> The way that tasks need to be freed has changed since 2.5.61 ---
>> I think we need to do something like the attached patch (keep
>> __put_task_struct() in kernel/fork.c; have ia64-specific
>> free_task_struct() in arch/ia64/kernel/process.c) otherwise the
>> user_struct will never have its reference count deleted and so
>> will not be freed.
William> I think you might be in trouble. From entry.S:
William> /* * Invoke schedule_tail(task) while preserving
William> in0-in7, which may be nee ded * in case a system call gets
William> restarted. */ GLOBAL_ENTRY(ia64_invoke_schedule_tail)
William> Well, you're going to need to pass a parameter to
William> schedule_tail() namely, the previous task, and find some
William> other way to save in0-in7. schedule_tail() now relies on
William> the task getting passed to it to free it.
That's why ia64_invoke_schedule_tail() exists in the first place: the
previously running task is passed in r8. In other words: no problem.
--david
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-12 6:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-11 3:44 [Linux-ia64] Memory leak in 2.5.64 Peter Chubb
2003-03-12 6:55 ` David Mosberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox