From patchwork Thu Aug 13 08:11:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 11711967 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 8EBEB13B1 for ; Thu, 13 Aug 2020 08:11:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DCB820781 for ; Thu, 13 Aug 2020 08:11:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lSicE/N4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DCB820781 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 41FFA6B000C; Thu, 13 Aug 2020 04:11:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3F8596B000D; Thu, 13 Aug 2020 04:11:33 -0400 (EDT) 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 30F568D0001; Thu, 13 Aug 2020 04:11:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 17CED6B000C for ; Thu, 13 Aug 2020 04:11:33 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C806D364B for ; Thu, 13 Aug 2020 08:11:32 +0000 (UTC) X-FDA: 77144826024.16.tail40_0e0593326ff2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 96622100E690C for ; Thu, 13 Aug 2020 08:11:32 +0000 (UTC) X-Spam-Summary: 1,0,0,a7cd1f67ecc01165,d41d8cd98f00b204,huangzhaoyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1381:1437:1534:1540:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2895:3138:3139:3140:3141:3142:3308:3352:3865:3867:3871:3872:4250:5007:6119:6120:6261:6653:7901:7903:8603:9413:10004:11026:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:13069:13184:13229:13311:13357:14096:14181:14384:14687:14721:14915:21080:21444:21451:21627:21666:21990:30054:30090,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04y8qrx5dybk5k95zjzz7yz4pba9mycyhbrcbsa6xzwo793tr7gkefzm1nn8m54.cfnz5boowrf4kncox8mrf1wxx4mxhq7c9szxdownk3zqg6cxkr83swcpesgaw73.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: tail40_0e0593326ff2 X-Filterd-Recvd-Size: 3672 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Aug 2020 08:11:32 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id k18so2419957pfp.7 for ; Thu, 13 Aug 2020 01:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=wAiLcnSB5sATjldGL+GyGneCafWikkuMCjLyf4n50Cg=; b=lSicE/N4STsmjew96O7TymkPh4k9iZ9jODJlSEHdEQ2HibL9sD7rfPSZXJCJkV+4Gl p6HYCEtiyViP6+QP67IevMsutWM/sfkjLxD4DSU5handoBJGFHBDtrwA09fJKlBcsc2k JAlNFbat2xw2PRlm7tDXiFWDUKNWVsUp5dIdqZSGTnkrJUOJQdRj3l0AEdsxTwqvEhRb 0gqe5Ncyg4HOm4PlLXkd6mC2Er3cFn8qGuv4Q0MdGL32GiERhFDf2LBK0kBr8OyuXap4 iAuetOSfBijbQ1AWM2Ep3F08fx0grAUJB8oupyYnnn6a6B7YqqL+dUT6+Mxl5d2lBkNQ KGjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=wAiLcnSB5sATjldGL+GyGneCafWikkuMCjLyf4n50Cg=; b=LtR1z01K6Y/i0lUGqNqDhXlGUu6DRR4JLi4x7ApCJLjuokdI56jjc+51iIp0P0kSEC y5Br8sy/lFm/jbAIOadfyyTwf7MGmaDgvuxauWbqvNd2VtKRm6A4hPJ6vob/+Tp/TYXH NYpRL5eF2MYai3GH3gESCTQvQgPi4VuBBSmrWlUGd/O5R45kdo3FWrAIf8nR8Yue4eOe P9KSySWFjHCIgwNwpt/VOFveYruAacanMavzK2dXj18mODqzaxdvk4LOXvxJ0kuDI9kX acEfkejSA/1GsKKpKKUPNNg2xfWL2xE5MYhJioYwgFyqIb65f96Jg89wIGtx/r8vCPaS a3/g== X-Gm-Message-State: AOAM533sWXvVIlT+pqcNn5ACSqOV/uCk7HMTb4nlQqT7R4yQNFJhTYyv OMfqRiLU3qiAHwCYcY5R+/8= X-Google-Smtp-Source: ABdhPJyAzMYh/Gg9GkOIskWcpnu6269XaG/I3Z0yIn7KO/JvVuFusQIWhcDQnBmjVsNj1KBsU5rAhw== X-Received: by 2002:a63:1b12:: with SMTP id b18mr2683225pgb.21.1597306291260; Thu, 13 Aug 2020 01:11:31 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 205sm4801139pfy.9.2020.08.13.01.11.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2020 01:11:30 -0700 (PDT) From: Zhaoyang Huang X-Google-Original-From: Zhaoyang Huang To: Roman Gushchin , Andrew Morton , Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] mm : using bdi->ra_pages instead of ra->ra_pages within readahead Date: Thu, 13 Aug 2020 16:11:22 +0800 Message-Id: <1597306282-29927-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.7.9.5 X-Rspamd-Queue-Id: 96622100E690C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000027, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: file->f_ra->ra_pages will remain the initialized value since it opend, which may be NOT equal to bdi->ra_pages as the latter one is updated somehow(etc, echo xxx > /sys/block/dm/queue/read_ahead_kb).So having readahead use bdi->ra_pages. Signed-off-by: Zhaoyang Huang --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d78f577..259dcfd 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2499,8 +2499,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) */ fpin = maybe_unlock_mmap_for_io(vmf, fpin); ra->start = max_t(long, 0, offset - ra->ra_pages / 2); - ra->size = ra->ra_pages; - ra->async_size = ra->ra_pages / 4; + ra->size = inode_to_bdi(mapping->host)->ra_pages; + ra->async_size = ra->size / 4; ra_submit(ra, mapping, file); return fpin; }