Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665325 > unrolled thread

[PATCH v3] ubifs: Change gfp flags in page allocation for bulk read

Started byHyunchul Lee <hyc.lee@gmail.com>
First post2017-06-14 02:40 +0200
Last post2017-06-14 02:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] ubifs: Change gfp flags in page allocation for bulk read Hyunchul Lee <hyc.lee@gmail.com> - 2017-06-14 02:40 +0200

#1665325 — [PATCH v3] ubifs: Change gfp flags in page allocation for bulk read

FromHyunchul Lee <hyc.lee@gmail.com>
Date2017-06-14 02:40 +0200
Subject[PATCH v3] ubifs: Change gfp flags in page allocation for bulk read
Message-ID<tS4vL-6uo-5@gated-at.bofh.it>
From: Hyunchul Lee <cheol.lee@lge.com>

In low memory situations, page allocations for bulk read
can kill applications for reclaiming memory, and print an
failure message when allocations are failed.
Because bulk read is just an optimization, we don't have
to do these and can stop page allocations.

Though this siutation happens rarely, add __GFP_NORETRY
to prevent from excessive memory reclaim and killing
applications, and __GFP_WARN to suppress this failure
message.

For this, Use readahead_gfp_mask for gfp flags when
allocating pages.

Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
---
v3:
* fix the invalid format of version history in 
 this patch.

v2:
* rewrite a commit message for explaining why this
 patch is needed.

 fs/ubifs/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index d9ae86f..4396c04 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -735,6 +735,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
 	int err, page_idx, page_cnt, ret = 0, n = 0;
 	int allocate = bu->buf ? 0 : 1;
 	loff_t isize;
+	gfp_t ra_gfp_mask = readahead_gfp_mask(mapping) & ~__GFP_FS;
 
 	err = ubifs_tnc_get_bu_keys(c, bu);
 	if (err)
@@ -796,8 +797,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
 
 		if (page_offset > end_index)
 			break;
-		page = find_or_create_page(mapping, page_offset,
-					   GFP_NOFS | __GFP_COLD);
+		page = find_or_create_page(mapping, page_offset, ra_gfp_mask);
 		if (!page)
 			break;
 		if (!PageUptodate(page))
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web