Skip to content

Commit 77d0752

Browse files
axboeakpm00
authored andcommitted
mm/readahead: add readahead_control->dropbehind member
If ractl->dropbehind is set to true, then folios created are marked as dropbehind as well. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Reviewed-by: Kirill A. Shutemov <[email protected]> Cc: Brian Foster <[email protected]> Cc: Chris Mason <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent cceba6f commit 77d0752

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/linux/pagemap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,7 @@ struct readahead_control {
13581358
pgoff_t _index;
13591359
unsigned int _nr_pages;
13601360
unsigned int _batch_count;
1361+
bool dropbehind;
13611362
bool _workingset;
13621363
unsigned long _pflags;
13631364
};

mm/readahead.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ static void read_pages(struct readahead_control *rac)
181181
static struct folio *ractl_alloc_folio(struct readahead_control *ractl,
182182
gfp_t gfp_mask, unsigned int order)
183183
{
184-
return filemap_alloc_folio(gfp_mask, order);
184+
struct folio *folio;
185+
186+
folio = filemap_alloc_folio(gfp_mask, order);
187+
if (folio && ractl->dropbehind)
188+
__folio_set_dropbehind(folio);
189+
190+
return folio;
185191
}
186192

187193
/**

0 commit comments

Comments
 (0)