Skip to contentSkip to conversation

Memory leaks in SMP MIPS linux 2.4.9?

DISCUSSION Krishna Kondaka 1 participant 1 message Nov 28, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

Thanks for the quick reply ralf!

Sorry for not mentioning that I did already patch my 2.4.9 with the fix that you mentioned. Even then the MemFree is continuously going down.

Quoted 24 lines · Krishna Kondaka
Quoted 3 lines

I suspect that there are some memory leaks in the SMP MIPS linux 2.4.9. I would like to know if any one found the root cause and fixed them.

See patch below for fix.

Quoted 4 lines

I just ran the script for 3 hours are here is the diff between the out put of /proc/meminfo and /proc/slabinfo before and after the test run ( lines with "<" are before the test and lines with ">" are after the test)

(Try diff -u which generates much more human readable output.)

Quoted 8 lines

When I did some investigation, it looked like d_lookup() is not finding /proc/meminfo and /proc/slabinfo in the dcache and it is doing d_alloc() to add these to the cache every time cat /proc/meminfo or cat /proc/slabinfo is done. This looked odd and I ran the same script on x86 based linux (running 2.4.2) and I did not see MemFree (or any other caches) changing after the test was run for an hour. I am not sure how this is architecture dependent.

Quoted 2 lines

These caches essentially keep growing until you run out of memory which is when they'll be freed.

Yeah! But there is no need for them to grow because I am accessing the same file names again and again and hence they should be available in the cache after the first time. d_alloc()s are not not being done when referencing /lib/libc.so.6 second time but they are being done when referencing /proc/meminfo or /proc/slabinfo. The behavior is different because "/proc" is a mount point and "/lib" is not. But I still feel that there is no need to do d_alloc() for repeatedly when /proc/meminfo is already in the cache(I have printed the entire dcache entries and it shows that /proc/meminfo is in the dcache).

Thanks
Krishna

Quoted 18 lines

Ralf

include/asm-mips/mmu_context.h renamed from include/asm-mips/mmu_context.h.orig +4 -1
@@ -109,7 +109,10 @@
 */
 extern inline void destroy_context(struct mm_struct *mm)
 {
-	/* Nothing to do.  */
+#ifdef CONFIG_SMP
+	if (mm->context)
+		kfree((void *)mm->context);
+#endif
 }
 
 /*