The patch titled Subject: mm: Refactor readahead defines in mm.h has been added to the -mm tree. Its filename is mm-refactor-readahead-defines-in-mmh.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-refactor-readahead-defines-in-mmh.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-refactor-readahead-defines-in-mmh.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Nikolay Borisov <nborisov@xxxxxxxx> Subject: mm: Refactor readahead defines in mm.h All users of VM_MAX_READAHEAD actually convert it to kbytes and then to pages. Define the macro explicitly as (SZ_128K / PAGE_SIZE). This simplifies the expression in every filesystem. Also rename the macro to VM_READAHEAD_PAGES to properly convey its meaning. Finally remove unused VM_MIN_READAHEAD Link: http://lkml.kernel.org/r/20181221144053.24318-1-nborisov@xxxxxxxx Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx> Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Eric Van Hensbergen <ericvh@xxxxxxxxx> Cc: Latchesar Ionkov <lucho@xxxxxxxxxx> Cc: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> Cc: David Howells <dhowells@xxxxxxxxxx> Cc: Chris Mason <clm@xxxxxx> Cc: Josef Bacik <josef@xxxxxxxxxxxxxx> Cc: David Sterba <dsterba@xxxxxxxx> Cc: Miklos Szeredi <miklos@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/block/blk-core.c~mm-refactor-readahead-defines-in-mmh +++ a/block/blk-core.c @@ -496,8 +496,7 @@ struct request_queue *blk_alloc_queue_no if (!q->stats) goto fail_stats; - q->backing_dev_info->ra_pages = - (VM_MAX_READAHEAD * 1024) / PAGE_SIZE; + q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES; q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; q->backing_dev_info->name = "block"; q->node = node_id; --- a/fs/9p/vfs_super.c~mm-refactor-readahead-defines-in-mmh +++ a/fs/9p/vfs_super.c @@ -92,7 +92,7 @@ v9fs_fill_super(struct super_block *sb, return ret; if (v9ses->cache) - sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_SIZE; + sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; sb->s_flags |= SB_ACTIVE | SB_DIRSYNC; if (!v9ses->cache) --- a/fs/afs/super.c~mm-refactor-readahead-defines-in-mmh +++ a/fs/afs/super.c @@ -423,7 +423,7 @@ static int afs_fill_super(struct super_b ret = super_setup_bdi(sb); if (ret) return ret; - sb->s_bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_SIZE; + sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; /* allocate the root inode and dentry */ if (as->dyn_root) { --- a/fs/btrfs/disk-io.c~mm-refactor-readahead-defines-in-mmh +++ a/fs/btrfs/disk-io.c @@ -2945,7 +2945,7 @@ int open_ctree(struct super_block *sb, sb->s_bdi->congested_fn = btrfs_congested_fn; sb->s_bdi->congested_data = fs_info; sb->s_bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK; - sb->s_bdi->ra_pages = VM_MAX_READAHEAD * SZ_1K / PAGE_SIZE; + sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; sb->s_bdi->ra_pages *= btrfs_super_num_devices(disk_super); sb->s_bdi->ra_pages = max(sb->s_bdi->ra_pages, SZ_4M / PAGE_SIZE); --- a/fs/fuse/inode.c~mm-refactor-readahead-defines-in-mmh +++ a/fs/fuse/inode.c @@ -1009,7 +1009,7 @@ static int fuse_bdi_init(struct fuse_con if (err) return err; - sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_SIZE; + sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; /* fuse does it's own writeback accounting */ sb->s_bdi->capabilities = BDI_CAP_NO_ACCT_WB | BDI_CAP_STRICTLIMIT; --- a/include/linux/mm.h~mm-refactor-readahead-defines-in-mmh +++ a/include/linux/mm.h @@ -26,6 +26,7 @@ #include <linux/page_ref.h> #include <linux/memremap.h> #include <linux/overflow.h> +#include <linux/sizes.h> struct mempolicy; struct anon_vma; @@ -2489,8 +2490,7 @@ int __must_check write_one_page(struct p void task_dirty_inc(struct task_struct *tsk); /* readahead.c */ -#define VM_MAX_READAHEAD 128 /* kbytes */ -#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ +#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) int force_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read); _ Patches currently in -mm which might be from nborisov@xxxxxxxx are fs-dont-opencode-lru_to_page.patch mm-refactor-readahead-defines-in-mmh.patch