Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1120528imu; Fri, 21 Dec 2018 13:00:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Yc9arKo+dSqCyUAPyoQJ7XavpXh2gvgdg/raU2CEzvChT3uOdoaRqVu1h4Y9cWj19eX84 X-Received: by 2002:a17:902:209:: with SMTP id 9mr4102330plc.288.1545426049104; Fri, 21 Dec 2018 13:00:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545426049; cv=none; d=google.com; s=arc-20160816; b=0RbZM4+/NPw4KS94gz3q9LPH99iujylg1bWz56PSM4Z0RCzwiuHJaGolN0wvIkO4VD RSSVu+GcH4/eFjBX3HIBC7e+RDJWpEjIHwQKCPEhPvwUEE0WHLUThhf/ps2MPIOMlEF6 l6+Asf7GQGUa80B+caTR0+wn7H14IVFEqSwSOvRgh3ZGaUuiSSkesWwgEYUd19jNLhxi bmIijda1mcA14g+4mBv9/pcbxCxDN54nu8dQL+tAXLy81pdPizzQWg+CnPLldW2Usf0G sfSaWXWew8C/UtU9uwrzQnTKjojbPVc9Roy/UJx8eVSuYayQTb5AlCfSl66SmJU2xVIe 0t7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=N79YGQL5M/DA8u8KKxmWhuszQkY2fFpDzWf+pWRmpno=; b=TbwlswdtC+6YdmnbDVe1/6papMNn/+on775QifO73V5eXzS/2S/hHZGluS0ibW1hiO 8Tw8KUM9qIJT/EbZPiy5zylR9KlMRSuM9ZZwXXwPVHubh7cc4zVEUqM550YjH8y+EOIz 2HA8MsgDowlbEXXbqAd/wargcEoLQdQLBfP6PTnBdVwmls6RDr0xmf00xO2M6cFPUU+b zm/RGeOHDhx5xPAAORZet/lnrL1KiuCmXZh3Q99yEY41OQg5v0sEUGt5F5ob2AGf5iyB DocRv2Pw9JzxSk10O/u+r9rCh0weF/5PmZ/SGBB6ZVHHs2tSvdExwCe34HuRBx8CKwHi CplA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si3065524pgh.510.2018.12.21.13.00.33; Fri, 21 Dec 2018 13:00:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390418AbeLUMxZ (ORCPT + 99 others); Fri, 21 Dec 2018 07:53:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:40082 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388253AbeLUMxZ (ORCPT ); Fri, 21 Dec 2018 07:53:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 92E18AE72; Fri, 21 Dec 2018 12:53:22 +0000 (UTC) From: Nikolay Borisov To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, Nikolay Borisov Subject: [PATCH] mm: Define VM_(MAX|MIN)_READAHEAD via sizes.h constants Date: Fri, 21 Dec 2018 14:53:14 +0200 Message-Id: <20181221125314.5177-1-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All users of the aformentioned macros convert them to kbytes by multplying. Instead, directly define the macros via the aptly named SZ_16K/SZ_128K ones. Also remove the now redundant comments explaining that VM_* are defined in kbytes it's obvious. No functional changes. Signed-off-by: Nikolay Borisov --- I guess it makes sense for this to land via Andrew's mmotm tree? block/blk-core.c | 3 +-- fs/9p/vfs_super.c | 2 +- fs/afs/super.c | 2 +- fs/btrfs/disk-io.c | 2 +- fs/fuse/inode.c | 2 +- include/linux/mm.h | 5 +++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index deb56932f8c4..d28b2eeec07e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1031,8 +1031,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, 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_MAX_READAHEAD / PAGE_SIZE; q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; q->backing_dev_info->name = "block"; q->node = node_id; diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 48ce50484e80..5c9f757410ae 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -92,7 +92,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, return ret; if (v9ses->cache) - sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_SIZE; + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE; sb->s_flags |= SB_ACTIVE | SB_DIRSYNC; if (!v9ses->cache) diff --git a/fs/afs/super.c b/fs/afs/super.c index dcd07fe99871..d1f3af74481a 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -399,7 +399,7 @@ static int afs_fill_super(struct super_block *sb, 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_MAX_READAHEAD / PAGE_SIZE; /* allocate the root inode and dentry */ if (as->dyn_root) { diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 6d776717d8b3..d84e7283d24b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2900,7 +2900,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_MAX_READAHEAD / PAGE_SIZE; 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); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 568abed20eb2..25766e9035b1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1009,7 +1009,7 @@ static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb) if (err) return err; - sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_SIZE; + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE; /* fuse does it's own writeback accounting */ sb->s_bdi->capabilities = BDI_CAP_NO_ACCT_WB | BDI_CAP_STRICTLIMIT; diff --git a/include/linux/mm.h b/include/linux/mm.h index 5411de93a363..e2085eaceae9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -26,6 +26,7 @@ #include #include #include +#include struct mempolicy; struct anon_vma; @@ -2396,8 +2397,8 @@ int __must_check write_one_page(struct page *page); 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_MAX_READAHEAD SZ_128K +#define VM_MIN_READAHEAD SZ_16K /* includes current page */ int force_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read); -- 2.17.1