[Devel] [PATCH rh7 2/2] sysfs: do not account sysfs_ino_ida allocations to memcg

Vladimir Davydov vdavydov at parallels.com
Sun May 3 08:26:54 PDT 2015


sysfs_ino_ida is used for sysfs inode number allocations. Since IDA has
a layered structure, different IDs can reside on the same layer, which
is currently accounted to some memory cgroup. The problem is that each
kmem cache of a memory cgroup has its own directory on sysfs (under
/sys/fs/kernel/<cache-name>/cgroup). If the inode number of such a
directory or any file in it gets allocated from a layer accounted to the
cgroup which the cache is created for, the cgroup will get pinned for
good, because one has to free all kmem allocations accounted to a cgroup
in order to release it and destroy all its kmem caches. That said we
must not account layers of sysfs_ino_ida to any memory cgroup.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 fs/sysfs/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 2c68c2050606..e12273c93e6f 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -265,7 +265,7 @@ static int sysfs_alloc_ino(unsigned int *pino)
 	spin_unlock(&sysfs_ino_lock);
 
 	if (rc == -EAGAIN) {
-		if (ida_pre_get(&sysfs_ino_ida, GFP_KERNEL))
+		if (ida_pre_get(&sysfs_ino_ida, GFP_KERNEL | __GFP_NOACCOUNT))
 			goto retry;
 		rc = -ENOMEM;
 	}
-- 
1.7.10.4




More information about the Devel mailing list