[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241220154831.1086649-6-axboe@kernel.dk>
Date: Fri, 20 Dec 2024 08:47:43 -0700
From: Jens Axboe <axboe@...nel.dk>
To: linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Cc: hannes@...xchg.org,
clm@...a.com,
linux-kernel@...r.kernel.org,
willy@...radead.org,
kirill@...temov.name,
bfoster@...hat.com,
Jens Axboe <axboe@...nel.dk>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: [PATCH 05/12] mm/readahead: add readahead_control->dropbehind member
If ractl->dropbehind is set to true, then folios created are marked as
dropbehind as well.
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
include/linux/pagemap.h | 1 +
mm/readahead.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bcf0865a38ae..5da4b6d42fae 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1353,6 +1353,7 @@ struct readahead_control {
pgoff_t _index;
unsigned int _nr_pages;
unsigned int _batch_count;
+ bool dropbehind;
bool _workingset;
unsigned long _pflags;
};
diff --git a/mm/readahead.c b/mm/readahead.c
index 8a62ad4106ff..c0a6dc5d5686 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -191,7 +191,13 @@ static void read_pages(struct readahead_control *rac)
static struct folio *ractl_alloc_folio(struct readahead_control *ractl,
gfp_t gfp_mask, unsigned int order)
{
- return filemap_alloc_folio(gfp_mask, order);
+ struct folio *folio;
+
+ folio = filemap_alloc_folio(gfp_mask, order);
+ if (folio && ractl->dropbehind)
+ __folio_set_dropbehind(folio);
+
+ return folio;
}
/**
--
2.45.2
Powered by blists - more mailing lists