Merge branch 'akpm' (patches from Andrew)
[muen/linux.git] / fs / notify / fanotify / fanotify_user.c
index d736a833fe39928b020c77e9f8f1fa7a304d1af9..69054886915b6bd2964393089af00037114966ae 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/uaccess.h>
 #include <linux/compat.h>
 #include <linux/sched/signal.h>
+#include <linux/memcontrol.h>
 
 #include <asm/ioctls.h>
 
@@ -731,6 +732,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
 
        group->fanotify_data.user = user;
        atomic_inc(&user->fanotify_listeners);
+       group->memcg = get_mem_cgroup_from_mm(current->mm);
 
        oevent = fanotify_alloc_event(group, NULL, FS_Q_OVERFLOW, NULL);
        if (unlikely(!oevent)) {
@@ -932,7 +934,8 @@ COMPAT_SYSCALL_DEFINE6(fanotify_mark,
  */
 static int __init fanotify_user_setup(void)
 {
-       fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, SLAB_PANIC);
+       fanotify_mark_cache = KMEM_CACHE(fsnotify_mark,
+                                        SLAB_PANIC|SLAB_ACCOUNT);
        fanotify_event_cachep = KMEM_CACHE(fanotify_event_info, SLAB_PANIC);
        if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
                fanotify_perm_event_cachep =