From patchwork Fri Dec 21 14:40:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10740515 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 C13156C5 for ; Fri, 21 Dec 2018 14:41:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF79125D9E for ; Fri, 21 Dec 2018 14:41:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A287426E56; Fri, 21 Dec 2018 14:41:00 +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=ham 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 60DA326E3C for ; Fri, 21 Dec 2018 14:40:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83E418E0005; Fri, 21 Dec 2018 09:40:58 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7ED388E0001; Fri, 21 Dec 2018 09:40:58 -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 6DC688E0005; Fri, 21 Dec 2018 09:40:58 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 12D238E0001 for ; Fri, 21 Dec 2018 09:40:58 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id 39so6204522edq.13 for ; Fri, 21 Dec 2018 06:40:58 -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=P26IQLujuSZwmpqoYH5hETEovZg0Dq3zEOhoMLXNooE=; b=dRwnIGu7q0BqenDk+nP5Nga5m2J3wpAmipmTbTvZLf78A0VMtaDHJewqodbujWLUOt lWbmfq3uCZV7/Fsk5ucnTkaVUHivFdV9VFc2J9hcNdF08r/mnzcBMd1TNSJHzAUD6coS w17ENm/wNepAGXlHcU+CVc6ASdtXvD9r/ayrvZzFh+Ym6gmGHITkhTk4F29TwGNXC7xY UtdOfmem3COsdWCnANinPqX10E+QS1pHtz6EV2R4FvZHxy1Jcv8ftp7uwR6eqdqn6iMs I6t9JAIgLYGohCuNn4KPG4SyaTY+pAfumL3rAZAH0TOrFZeKhEpOBhFk5Xl0fnyp3/Y+ SoYA== 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+aEWaSoos3653C85PkHW0V5ofZZfBaLomLg7cO+j+net7s+K4qxkVc aFLvnSFJ8yXrU+bVYoEbh3CVloM228Y8HN0/smnsHcGLfkV/5ZJp6iAizKv11mRLlKKGd9xkOx/ mjaYNf5pGASLtYxDeahZ0GKf47ev/9RCX09ZcDDmMVIoSby/2u9uSTmMn8GJJ/2sVug== X-Received: by 2002:a17:906:33d9:: with SMTP id w25-v6mr2270898eja.190.1545403257567; Fri, 21 Dec 2018 06:40:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/UfH5CWfUI46hCERy9FuoXHESFl0KRXy5ZOgYPBDJphz9YyXAOnqicpl+ndTBtByFnlzf8G X-Received: by 2002:a17:906:33d9:: with SMTP id w25-v6mr2270848eja.190.1545403256473; Fri, 21 Dec 2018 06:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545403256; cv=none; d=google.com; s=arc-20160816; b=JmFRidSgjiTX9VU7EdCjC8BFNyDHFk1Wpai2Kyy6g3XvKjnFrMg/qOU6MFvjsimySc vHfFOMs5k/i//4Bvx2Iik5Sw4PJ6Tc6Wmb8HLJLyRNcFDV1Df1fzPcgLxdL5UYd4r3ia jLAqzr2mx1GjnFUYHGhpVbiN5Vc6ntfbQf4ZxCF5HRub9hVHYviK5j7ZN3g238gX7dm6 /odilTw5Q2gEY+g/oCMvGfp9efyABlYtKM+LGYKPHs7TqJu9F5jPhzQTNU5t3I36vEFA FmO3BD4/7F/eWa49WvoIN3j26UD7BL1+YKLSAYGVLS/qSm8IRxaB3azNhyTMu0oTSn5i bnsg== 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=P26IQLujuSZwmpqoYH5hETEovZg0Dq3zEOhoMLXNooE=; b=WPwranPXQzId7cWnSi2J5BduM2qs2NxzK63ZxVmFZq6qBWsZvreMMg0o+JI3m5FCbo 0nHdHyE4QJxXHzctroOILSPUJahZiFVOvbabEMqQCTa6BBC/W8yGYsoF6JJTkeWS+9DZ YR/7CnX4buHeVXTZHzsY+J9kwGOLVVUBO5fyQqAPZ5q2zEoNWLQJy4oU+ROk/ksFwEiB hes919hn8dO1K8BmC+4f/Hb5b5TgcLcVGFavENgImBZ/D1qY/AUWtmxF92Z3mU6Yz36v 6BuYLcxGuGCaHpIAd7RggZWBoVaykZWSaFCItBvaKOXIRIpBpepPKgZBeyU3qbLGnJLD LYNg== 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 g16-v6si8175611ejf.225.2018.12.21.06.40.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 06:40:56 -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 relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BECC3ACA8; Fri, 21 Dec 2018 14:40:55 +0000 (UTC) From: Nikolay Borisov To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: willy@infradead.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Nikolay Borisov Subject: [PATCH] mm: Refactor readahead defines in mm.h Date: Fri, 21 Dec 2018 16:40:53 +0200 Message-Id: <20181221144053.24318-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 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 Signed-off-by: Nikolay Borisov Reviewed-by: Matthew Wilcox Reviewed-by: David Hildenbrand --- 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 | 4 ++-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index deb56932f8c4..d25c8564a117 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_READAHEAD_PAGES; 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..10d3bd3f534b 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_READAHEAD_PAGES; sb->s_flags |= SB_ACTIVE | SB_DIRSYNC; if (!v9ses->cache) diff --git a/fs/afs/super.c b/fs/afs/super.c index dcd07fe99871..e684f6769b15 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_READAHEAD_PAGES; /* 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..ee47d8b5b50c 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_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); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 568abed20eb2..d3eab53a29b7 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_READAHEAD_PAGES; /* 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..1579082af177 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,7 @@ 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_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);