Memory leak in sysfs
Quoted 12 lines · Nanhai
Some stress testes show there is a memory leak in the latest kernel. I found the memory leak is in sysfs.
Here is a patch against 2.6.10-rc2-mm4 to fix that.Signed-off-by Zou Nan hai <[email protected]>["sysfs-memleak-fix.patch" (application/octet-stream)]
diff -Nraup
a/fs/sysfs/dir.cb/fs/sysfs/dir.c
fs/sysfs/dir.c 2004-12-07 16:49:36.000000000 +0800 static int sysfs_dir_close(struct inode · line 355
Quoted 7 lines
fs/sysfs/dir.c 2004-12-07 16:49:36.000000000 +0800 renamed from fs/sysfs/dir.c 2004-12-06 13:04:56.000000000 +0800 +1
-0@@ -349,6 +349,7 @@ static int sysfs_dir_close(struct inode down(&dentry->d_inode->i_sem); list_del_init(&cursor->s_sibling); + sysfs_put(cursor); up(&dentry->d_inode->i_sem); return 0;
This is will be fixed when the patch that I posted
at http://marc.theaimsgroup.com/?l=linux-kernel&m=110204311025022&w=2
is applied (that patch calls release_sysfs_dirent, since there is no need for the reference counting of sysfs_put in this case). I believe that Greg had already indicated he was going to forward that patch to Linus (without the BUG_ON statement in my patch, which is fine with me).
__ ______________
Adam J. Richter \ /
[email protected] | g g d r a s i l