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

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

 



On Fri 24-11-17 20:36:25, Tetsuo Handa wrote:
> Commit 1d3d4437eae1bb29 ("vmscan: per-node deferred work") changed
> register_shrinker() to fail when memory allocation failed.
> Since that commit did not take appropriate precautions before allowing
> register_shrinker() to fail, there are many register_shrinker() users
> who continue running when register_shrinker() failed.
> Since continuing when register_shrinker() failed can cause memory
> pressure related issues (e.g. needless OOM killer invocations),
> this patch marks register_shrinker() as __must_check in order to
> encourage all register_shrinker() users to add error recovery path.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Cc: Glauber Costa <glauber@xxxxxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

As already pointed out, I do not think this is worth it. This function
is no different than many others which need error handling. The system
will work suboptimally when the shrinker is missing, no question about
that, but there is no immediate blow up otherwise. It is not all that
hard to find all those places and fix them up. We do not have hundreds
of them...

> ---
>  include/linux/shrinker.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
> index 388ff29..a389491 100644
> --- a/include/linux/shrinker.h
> +++ b/include/linux/shrinker.h
> @@ -75,6 +75,6 @@ struct shrinker {
>  #define SHRINKER_NUMA_AWARE	(1 << 0)
>  #define SHRINKER_MEMCG_AWARE	(1 << 1)
>  
> -extern int register_shrinker(struct shrinker *);
> +extern __must_check int register_shrinker(struct shrinker *);
>  extern void unregister_shrinker(struct shrinker *);
>  #endif
> -- 
> 1.8.3.1

-- 
Michal Hocko
SUSE Labs

--
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