On Mon, Apr 20, 2020 at 04:44:37PM -0700, Andrew Morton wrote: > From: Yafang Shao <laoar.shao@xxxxxxxxx> > Subject: mm, memcg: fix error return value of mem_cgroup_css_alloc() > > When I run my memcg testcase which creates lots of memcgs, I found > there're unexpected out of memory logs while there're still enough > available free memory. The error log is, mkdir: cannot create directory > 'foo.65533': Cannot allocate memory > > The reason is when we try to create more than MEM_CGROUP_ID_MAX memcgs, an > -ENOMEM errno will be set by mem_cgroup_css_alloc(), but the right errno > should be -ENOSPC "No space left on device", which is an appropriate errno > for userspace's failed mkdir. > > As the errno really misled me, we should make it right. After this patch, > the error log will be "mkdir: cannot create directory 'foo.65533': No > space left on device" > > [akpm@xxxxxxxxxxxxxxxxxxxx: s/EBUSY/ENOSPC/, per Michal] > Link: http://lkml.kernel.org/r/20200407063621.GA18914@xxxxxxxxxxxxxx > Link: http://lkml.kernel.org/r/1586192163-20099-1-git-send-email-laoar.shao@xxxxxxxxx > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > Suggested-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> > Acked-by: Michal Hocko <mhocko@xxxxxxxxxx> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx> > Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Fixes: 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>