All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, mhocko@kernel.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Glauber Costa <glauber@scylladb.com>
Subject: [PATCH v2 2/2] mm,vmscan: Mark register_shrinker() as __must_check
Date: Fri, 24 Nov 2017 20:36:25 +0900	[thread overview]
Message-ID: <1511523385-6433-2-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <1511523385-6433-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp>

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@I-love.SAKURA.ne.jp>
Cc: Glauber Costa <glauber@scylladb.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 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

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

  reply	other threads:[~2017-11-24 11:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24 11:36 [PATCH v2 1/2] mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed Tetsuo Handa
2017-11-24 11:36 ` Tetsuo Handa [this message]
2017-11-24 12:24   ` [PATCH v2 2/2] mm,vmscan: Mark register_shrinker() as __must_check Michal Hocko
2017-11-24 13:26     ` Tetsuo Handa
2017-11-24 13:37       ` Michal Hocko
2017-11-24 12:21 ` [PATCH v2 1/2] mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed Michal Hocko
2017-11-24 13:21   ` Tetsuo Handa
2017-11-24 13:28     ` Michal Hocko
2017-11-25  1:40       ` Tetsuo Handa
2017-11-27  8:29         ` Michal Hocko
2017-11-29 13:44           ` Tetsuo Handa
2017-11-29 13:55             ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1511523385-6433-2-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=glauber@scylladb.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.