Re: [PATCH] mm,vmscan: Mark register_shrinker() as __must_check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paolo Bonzini wrote:
> On 23/11/2017 10:56, Tetsuo Handa wrote:
> > Paolo Bonzini wrote:
> >> On 23/11/2017 07:34, Tetsuo Handa wrote:
> >>>> Just fix the numa aware shrinkers, as they are the only ones that
> >>>> will have this problem. There are only 6 of them, and only the 3
> >>>> that existed at the time that register_shrinker() was changed to
> >>>> return an error fail to check for an error. i.e. the superblock
> >>>> shrinker, the XFS dquot shrinker and the XFS buffer cache shrinker.
> >>>
> >>> You are assuming the "too small to fail" memory-allocation rule
> >>> by ignoring that this problem is caused by fault injection.
> >>
> >> Fault injection should also obey the too small to fail rule, at least by
> >> default.
> > 
> > Pardon? Most allocation requests in the kernel are <= 32KB.
> > Such change makes fault injection useless. ;-)
> 
> But if these calls are "too small to fail", you are injecting a fault on
> something that cannot fail anyway.  Unless you're aiming at removing
> "too small to fail", then I understand.
> 

The "too small to fail" does not mean that small allocations cannot fail.
It unlikely fails because it will retry forever unless killed as an OOM victim,
and currently we allow it to try memory allocation from memory reserves when
killed as an OOM victim. But such assumption is fragile. We unexpectedly
forget to allow it to try memory allocation from memory reserves (e.g. commit 
c288983dddf71421 ("mm/page_alloc.c: make sure OOM victim can try allocations
with no watermarks once")). There is no guarantee that small allocations
will not fail in future.

To me, using __GFP_NOFAIL for register_shrinker() sounds the simplest fix.
Adding error handling code to all register_shrinker() callers is not worth
bothering. In most runtime environments, kmalloc() in register_shrinker()
will be order 0.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux