From patchwork Fri Dec 21 12:53:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10740377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93E1D6C5 for ; Fri, 21 Dec 2018 12:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84E1F28623 for ; Fri, 21 Dec 2018 12:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 786B928752; Fri, 21 Dec 2018 12:53:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F59028623 for ; Fri, 21 Dec 2018 12:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D98398E0002; Fri, 21 Dec 2018 07:53:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D48228E0001; Fri, 21 Dec 2018 07:53:25 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36148E0002; Fri, 21 Dec 2018 07:53:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 67E208E0001 for ; Fri, 21 Dec 2018 07:53:25 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id m19so5894391edc.6 for ; Fri, 21 Dec 2018 04:53:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=N79YGQL5M/DA8u8KKxmWhuszQkY2fFpDzWf+pWRmpno=; b=tlzy31OeWBQ0TDDRV+5i/+pNPgvxmbI25ZTfo7sTxvFnPEuq0dQzDNTYEw13IZXIJ7 YA1Na/9u2KeICikm02nh3VyyIcwE83sHQoPV0CbSValLjDUFNZRmIavA2Rmzx25CAavB RfNM648YgzclJaN9ifqnm1UTUB6Fu0Y6bJIvbX+Y7z3VHTh323d2NO88aUFULrpjPw19 0v7jA4cO1w3Hy0uRxHfF9MpsyLlr11FCkkxcoFGi7TjmcEBwYLDPvNTgmKz7LSTjcHwU rJCFqptP+ZLrhrbQgcnq7P8aW2zOwUvJUxGVnnssw8tdryBzQszIUiDOQokKQZelQIti gimg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com X-Gm-Message-State: AA+aEWZS1J8OKyFVnEg2CqmucXECc611PLR37jN5IKk3PrNx7Ykof+HX 1IQ7OiWbmPEPVu16HG6JhwECM65BWVYuEUkc63GfbdWcyGfM5PAY2hAii5lCdmFSRZjcsedWm0U 42TqtUzQbpkYnWmNon7SLe8JxxfmZrJXSf73xVeCLYqH7HLQbOZnqOwDiScrhqTzJXg== X-Received: by 2002:a17:906:1f99:: with SMTP id t25-v6mr2066167ejr.36.1545396804884; Fri, 21 Dec 2018 04:53:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VPbq4U8X3DUVEGdxodncxysV7QVYoBOEs3vDed36/kpPffnd+GLlk7aMDV5TM/yWAGyBzG X-Received: by 2002:a17:906:1f99:: with SMTP id t25-v6mr2066118ejr.36.1545396803733; Fri, 21 Dec 2018 04:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545396803; cv=none; d=google.com; s=arc-20160816; b=fg/vVkiC5Foo8WEtDbrmSia38j5LFC64Vct8d+uu0GYWXokwq9Llw03HbKEK7MDLnX VJGGU+l5pgcGzumWDP3qw51Ek2MGGVZyWJqqAQZnIeTLXpV9Z8MEGvt2MRWzTwC3Iiuz BV0D27ZtKTHYTFyAKfUCT9wyEJL7EMHY6hF2wzrWTB6zMnW6yoJpqJXxoYus73h1235n 2dfR8yGy9kfOo4M/V8MZW2PCwqtCiW8+5Q4Mtb781BBZ2f2wtQhLZg37vGamCm3vPs89 7BOay+I+z+6gfb+phIs7Hoggxch/ffjc2t8xi1GTW69Wk/L8p8VanFDjK+xZloH+LdX0 5++w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=N79YGQL5M/DA8u8KKxmWhuszQkY2fFpDzWf+pWRmpno=; b=Q2QA4wwHd5OOYFKtNhq5Zf5MCaiNEsOIYOiqRd6Gdvxr1cQlCZghY6evhonm2zkUjm zotXl2JLh6XaYGVxu0B/oHfmG20UgBQ+dcE1wopvm7hlyj8hIC1bXeEyButhCmUPmp0Y bRS9oXpQ3FAnyrlyPdFcHAidru3TlCC4+K7WiUzj003Cdg/kypdqhhrtIYtCrTYFtRUo sRFPs3LG7zuEleD974alyix7PVF7aejjFSu0VzwwP5bIL5bj2xwShdkVvBLuvY/myn1M KSMD2TShBwlCzkQuqlvrNA5l3PH9GL9NpBw0UF5LuAcYaGUqWUpVIJcvSCDBICFCP31C DlOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id o13si1491076edr.264.2018.12.21.04.53.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 04:53:23 -0800 (PST) Received-SPF: pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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);