[RFC PATCH 01/26] block: bdev: blockdev page cache is movable

Johannes Weiner
2023-04-18T19:14:23Z

While inspecting page blocks for the type of pages in them, I noticed
a large number of blockdev cache in unmovable blocks. However, these
pages are actually on the LRU, and their mapping has a .migrate_folio
callback; they can be reclaimed and compacted as necessary.

Put them into movable blocks, so they don't cause pollution, and
subsequent proliferation, of unmovable blocks.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
block/bdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/bdev.c b/block/bdev.c
index edc110d90df4..6abe4766d073 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -488,7 +488,7 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
inode->i_mode = S_IFBLK;
inode->i_rdev = 0;
inode->i_data.a_ops = &def_blk_aops;
- mapping_set_gfp_mask(&inode->i_data, GFP_USER);
+ mapping_set_gfp_mask(&inode->i_data, GFP_USER|__GFP_MOVABLE);

bdev = I_BDEV(inode);
mutex_init(&bdev->bd_fsfreeze_mutex);
--
2.39.2