From patchwork Thu Feb 27 21:13:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410657 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D73A317E0 for ; Thu, 27 Feb 2020 21:43:36 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C04C8246A1 for ; Thu, 27 Feb 2020 21:43:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C04C8246A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 98E98349614; Thu, 27 Feb 2020 13:35:04 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 4295F21FD65 for ; Thu, 27 Feb 2020 13:20:13 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id A69CB8AA9; Thu, 27 Feb 2020 16:18:17 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id A4EB9468; Thu, 27 Feb 2020 16:18:17 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:13:58 -0500 Message-Id: <1582838290-17243-371-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 370/622] lustre: llite, readahead: don't always use max RPC size X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wang Shilong , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Wang Shilong Since 64M RPC landed, @PTLRPC_MAX_BRW_PAGES will be 64M. And we always try to use this max possible RPC size to check whether we should avoid fast IO and trigger real context IO. This is not good for following reasons: (1) Since current default RPC size is still 4M, most of system won't use 64M for most of time. (2) Currently default readahead size per file is still 64M, which makes fast IO always run out of all readahead pages before next IO. This breaks what users really want for readahead grapping pages in advance. To fix this problem, we use 16M as a balance value if RPC smaller than 16M, patch also fix the problem that @ras_rpc_size could not grow bigger which is possibe in the following case: 1) set RPC to 16M 2) Set RPC to 64M In the current logic ras->ras_rpc_size will be kept as 16M which is wrong. WC-bug-id: https://jira.whamcloud.com/browse/LU-12043 Lustre-commit: 7864a6854c3d ("LU-12043 llite,readahead: don't always use max RPC size") Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/35033 Reviewed-by: Li Xi Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/llite_internal.h | 3 +++ fs/lustre/llite/rw.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h index d36e01e..36b620e 100644 --- a/fs/lustre/llite/llite_internal.h +++ b/fs/lustre/llite/llite_internal.h @@ -307,6 +307,9 @@ static inline struct pcc_inode *ll_i2pcci(struct inode *inode) return ll_i2info(inode)->lli_pcc_inode; } +/* default to use at least 16M for fast read if possible */ +#define RA_REMAIN_WINDOW_MIN MiB_TO_PAGES(16UL) + /* default to about 64M of readahead on a given system. */ #define SBI_DEFAULT_READAHEAD_MAX MiB_TO_PAGES(64UL) diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index c42bbab..ad55695 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -376,7 +376,7 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) * update read ahead RPC size. * NB: it's racy but doesn't matter */ - if (ras->ras_rpc_size > ra.cra_rpc_size && + if (ras->ras_rpc_size != ra.cra_rpc_size && ra.cra_rpc_size > 0) ras->ras_rpc_size = ra.cra_rpc_size; /* trim it to align with optimal RPC size */ @@ -1203,6 +1203,8 @@ int ll_readpage(struct file *file, struct page *vmpage) struct ll_readahead_state *ras = &fd->fd_ras; struct lu_env *local_env = NULL; struct inode *inode = file_inode(file); + unsigned long fast_read_pages = + max(RA_REMAIN_WINDOW_MIN, ras->ras_rpc_size); struct vvp_page *vpg; result = -ENODATA; @@ -1245,7 +1247,7 @@ int ll_readpage(struct file *file, struct page *vmpage) * a cl_io to issue the RPC. */ if (ras->ras_window_start + ras->ras_window_len < - ras->ras_next_readahead + PTLRPC_MAX_BRW_PAGES) { + ras->ras_next_readahead + fast_read_pages) { /* export the page and skip io stack */ vpg->vpg_ra_used = 1; cl_page_export(env, page, 1);