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/20241220154831.1086649-6-axboe@kernel.dk Signed-off-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Brian Foster <bfoster@redhat.com> Cc: Chris Mason <clm@meta.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent cceba6f commit 77d0752

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

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)