linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xfs: Add __GFP_NORETRY and __GFP_NOWARN to open-coded __GFP_NOFAIL allocations
@ 2015-09-20  7:03 Tetsuo Handa
  2015-09-20  7:03 ` [PATCH 2/2] xfs: Print comm name and pid when open-coded __GFP_NOFAIL allocation stucks Tetsuo Handa
  2015-09-20 23:11 ` [PATCH 1/2] xfs: Add __GFP_NORETRY and __GFP_NOWARN to open-coded __GFP_NOFAIL allocations Dave Chinner
  0 siblings, 2 replies; 8+ messages in thread
From: Tetsuo Handa @ 2015-09-20  7:03 UTC (permalink / raw)
  To: david; +Cc: xfs, linux-mm, Tetsuo Handa, Michal Hocko

kmem_alloc(), kmem_zone_alloc() and xfs_buf_allocate_memory() are doing
open-coded __GFP_NOFAIL allocations with warning messages as a canary.
But since small !__GFP_NOFAIL allocations retry forever inside memory
allocator unless TIF_MEMDIE is set, the canary does not help even if
allocations are stalling. Thus, this patch adds __GFP_NORETRY so that
we can know possibility of allocation deadlock.

If a patchset which makes small !__GFP_NOFAIL !__GFP_FS allocations not
retry inside memory allocator is merged, warning messages by
warn_alloc_failed() will dominate warning messages by the canary
because each thread calls warn_alloc_failed() for approximately
every 2 milliseconds. Thus, this patch also adds __GFP_NOWARN so that
we won't flood kernel logs by these open-coded __GFP_NOFAIL allocations.
Next patch compensates for lack of comm name and pid by addding them to
the canary.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Michal Hocko <mhocko@suse.com>
---
 fs/xfs/kmem.c    | 4 ++--
 fs/xfs/xfs_buf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
index a7a3a63..1fcf90d 100644
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -46,7 +46,7 @@ void *
 kmem_alloc(size_t size, xfs_km_flags_t flags)
 {
 	int	retries = 0;
-	gfp_t	lflags = kmem_flags_convert(flags);
+	gfp_t	lflags = kmem_flags_convert(flags) | __GFP_NORETRY | __GFP_NOWARN;
 	void	*ptr;
 
 	do {
@@ -111,7 +111,7 @@ void *
 kmem_zone_alloc(kmem_zone_t *zone, xfs_km_flags_t flags)
 {
 	int	retries = 0;
-	gfp_t	lflags = kmem_flags_convert(flags);
+	gfp_t	lflags = kmem_flags_convert(flags) | __GFP_NORETRY | __GFP_NOWARN;
 	void	*ptr;
 
 	do {
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 8ecffb3..cbd4f91 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -289,7 +289,7 @@ xfs_buf_allocate_memory(
 {
 	size_t			size;
 	size_t			nbytes, offset;
-	gfp_t			gfp_mask = xb_to_gfp(flags);
+	gfp_t			gfp_mask = xb_to_gfp(flags) | __GFP_NORETRY | __GFP_NOWARN;
 	unsigned short		page_count, i;
 	xfs_off_t		start, end;
 	int			error;
-- 
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>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-22  8:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-20  7:03 [PATCH 1/2] xfs: Add __GFP_NORETRY and __GFP_NOWARN to open-coded __GFP_NOFAIL allocations Tetsuo Handa
2015-09-20  7:03 ` [PATCH 2/2] xfs: Print comm name and pid when open-coded __GFP_NOFAIL allocation stucks Tetsuo Handa
2015-09-20 23:18   ` Dave Chinner
2015-09-21  1:23     ` [PATCH v2] " Tetsuo Handa
2015-09-22  5:12       ` Dave Chinner
2015-09-22  8:03         ` [PATCH v3] " Tetsuo Handa
2015-09-20 23:11 ` [PATCH 1/2] xfs: Add __GFP_NORETRY and __GFP_NOWARN to open-coded __GFP_NOFAIL allocations Dave Chinner
2015-09-21  1:23   ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).