Hi Andrew, Today's linux-next merge of the akpm-current tree got conflicts in: fs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c fs/notify/inotify/inotify_fsnotify.c between commits: 1e301852d657 ("fanotify: Avoid lost events due to ENOMEM for unlimited queues") b900420e4109 ("fsnotify: Let userspace know about lost events due to ENOMEM") from the ext3 tree and commit: d519ceef2ad6 ("fs: fsnotify: account fsnotify metadata to kmemcg") from the akpm-current tree. I fixed it up (see below - I simplified the obvious resolution a bit) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc fs/notify/fanotify/fanotify.c index d51e1bb781cf,0d9493ebc7cd..000000000000 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@@ -157,14 -148,16 +157,16 @@@ struct fanotify_event_info *fanotify_al if (fanotify_is_perm_event(mask)) { struct fanotify_perm_event_info *pevent; - pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp); + pevent = kmem_cache_alloc_memcg(fanotify_perm_event_cachep, - GFP_KERNEL, memcg); ++ gfp, group->memcg); if (!pevent) return NULL; event = &pevent->fae; pevent->response = 0; goto init; } - event = kmem_cache_alloc(fanotify_event_cachep, gfp); - event = kmem_cache_alloc_memcg(fanotify_event_cachep, GFP_KERNEL, - memcg); ++ event = kmem_cache_alloc_memcg(fanotify_event_cachep, gfp, ++ group->memcg); if (!event) return NULL; init: __maybe_unused diff --cc fs/notify/fanotify/fanotify.h index 8609ba06f474,51b797896c87..000000000000 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h diff --cc fs/notify/fanotify/fanotify_user.c index 72e367822efb,e5e5983051c0..000000000000 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@@ -756,8 -757,9 +757,9 @@@ SYSCALL_DEFINE2(fanotify_init, unsigne group->fanotify_data.user = user; atomic_inc(&user->fanotify_listeners); + group->memcg = get_mem_cgroup_from_mm(current->mm); - oevent = fanotify_alloc_event(NULL, FS_Q_OVERFLOW, NULL, group->memcg); + oevent = fanotify_alloc_event(group, NULL, FS_Q_OVERFLOW, NULL); if (unlikely(!oevent)) { fd = -ENOMEM; goto out_destroy_group; diff --cc fs/notify/inotify/inotify_fsnotify.c index 40dedb37a1f3,ed8e7b5f3981..000000000000 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c @@@ -98,15 -98,9 +98,15 @@@ int inotify_handle_event(struct fsnotif i_mark = container_of(inode_mark, struct inotify_inode_mark, fsn_mark); - event = kmalloc(alloc_len, GFP_KERNEL); + event = kmalloc_memcg(alloc_len, GFP_KERNEL, group->memcg); - if (unlikely(!event)) + if (unlikely(!event)) { + /* + * Treat lost event due to ENOMEM the same way as queue + * overflow to let userspace know event was lost. + */ + fsnotify_queue_overflow(group); return -ENOMEM; + } fsn_event = &event->fse; fsnotify_init_event(fsn_event, inode, mask);
Attachment:
pgpU7mCh88lNY.pgp
Description: OpenPGP digital signature