Skip to content

Commit 480a1a6

Browse files
hyeoncheolrichardweinberger
authored andcommitted
ubifs: Change gfp flags in page allocation for bulk read
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> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 07d41c3 commit 480a1a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ubifs/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
735735
int err, page_idx, page_cnt, ret = 0, n = 0;
736736
int allocate = bu->buf ? 0 : 1;
737737
loff_t isize;
738+
gfp_t ra_gfp_mask = readahead_gfp_mask(mapping) & ~__GFP_FS;
738739

739740
err = ubifs_tnc_get_bu_keys(c, bu);
740741
if (err)
@@ -796,8 +797,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
796797

797798
if (page_offset > end_index)
798799
break;
799-
page = find_or_create_page(mapping, page_offset,
800-
GFP_NOFS | __GFP_COLD);
800+
page = find_or_create_page(mapping, page_offset, ra_gfp_mask);
801801
if (!page)
802802
break;
803803
if (!PageUptodate(page))

0 commit comments

Comments
 (0)