From patchwork Fri Aug 14 01:30:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 11713279 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 46E2F109B for ; Fri, 14 Aug 2020 01:30:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0EDE02087C for ; Fri, 14 Aug 2020 01:30:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tGgYDeIL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EDE02087C 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 335228D0007; Thu, 13 Aug 2020 21:30:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2E65F8D0001; Thu, 13 Aug 2020 21:30:21 -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 1FE988D0007; Thu, 13 Aug 2020 21:30:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 07C168D0001 for ; Thu, 13 Aug 2020 21:30:21 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B9048180AD811 for ; Fri, 14 Aug 2020 01:30:20 +0000 (UTC) X-FDA: 77147443800.11.coil22_531312e26ff8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 8F012180F8B80 for ; Fri, 14 Aug 2020 01:30:20 +0000 (UTC) X-Spam-Summary: 1,0,0,5eb46b61b0ac3b75,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:6117:6119:6261:6653:7901:7903:9413:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:13069:13184:13229:13311:13357:14096:14181:14384:14394:14687:14721:14915:21080:21444:21451:21627:21666:21990:30054:30070:30090,0,RBL:209.85.216.66:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yr7348sjdjnfxhdzqostz6mcoffyp1cfyifszfyuepg4u4fk4nae3wxqiucbn.an8jg86sh56b19hmj61bek8arkjmmgc1z9y4zre4qi486c1c4z6x7wanfmxw5yh.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: coil22_531312e26ff8 X-Filterd-Recvd-Size: 3641 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 01:30:20 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id ep8so3635678pjb.3 for ; Thu, 13 Aug 2020 18:30:20 -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=E05mkCqzXxrSsimqBbaoP3O/M0O9dQBUk8zaG5pF28Y=; b=tGgYDeILxzeZgEplMAMIclLaIGMqeG9VZ1gaOPf4CISzJaXUJoa25zj/V4opuoBoQx QIIrmdYNoKirdiD9xKafJWUJNZKx/EWdm8v/wVZCr8hqyEIB5JFG8sw9vI3zHK3eaTvZ i5uQIkrgq7B6ChUy1zPK6CiRQTUctvUL/eNUvubMgY5WbeFATBuQ/ZDopXtZG0XIw7OS bKm64zx+RtZ5rdxbAaSaeHLTMidEYj8yzxHln4DNGcH+Qo0BKFd/MI5iJZSQJzIm/wVf 65PwYrv8ECwADSOqYlyEIDKDsVwi3AO6MZon78UId5jiCmeMzUdePVrOlDATWQr4sD/5 bgJw== 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=E05mkCqzXxrSsimqBbaoP3O/M0O9dQBUk8zaG5pF28Y=; b=Em9fssk2v1gAq9qFSL+6rZ5oHbfOyXSgUD6kayojWVpmkjFbBZfeaCVEplcOWWgL5e DKFfVrxFZTRSj1BC3AwzFp+J94tZ85t2ex2gPuGjGUJ+gsh0tZznfJBi+Fwm3zhW2wb0 IGoFY6sdm0UZh80M/DU1eeMCun+bhZX2OjRzUWJF1qZ9u4JP7kF6CGgpdSiQe7+95WTC mwUYEwggcsswNObwev1rMNfoNNov0gKX/dtWfOZvemlekcuyvLhOTfyujdDlpK0YLffb YH2cjImuadvRg4zDS2n2UAxEdazDGQvYhtu+ZAuuTfX9MLYjsTp4LYL0pVOCFSdifkR1 y6zw== X-Gm-Message-State: AOAM531RDVPaVf1GqpcuWtI6ta1Wu90kaWwu9ibHUeS89LWLvnztAQ++ Fy/b3+KMJbSO0J+36KQUruk= X-Google-Smtp-Source: ABdhPJwB0uG7rEidLNItw2kLQW5Ky+a0fQhuoWyBq9WMhF5fu2gziV9lR4WxbhmjaiSo+C427KKnpA== X-Received: by 2002:a17:90b:1985:: with SMTP id mv5mr334455pjb.43.1597368619205; Thu, 13 Aug 2020 18:30:19 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id u1sm6398306pgf.69.2020.08.13.18.30.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2020 18:30:18 -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: [PATCH] mm : update ra->ra_pages if it's NOT equal to bdi->ra_pages Date: Fri, 14 Aug 2020 09:30:11 +0800 Message-Id: <1597368611-7631-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.7.9.5 X-Rspamd-Queue-Id: 8F012180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000471, 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 sync ra->ra_pages to the updated value when sync read. Signed-off-by: Zhaoyang Huang --- mm/filemap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/filemap.c b/mm/filemap.c index d78f577..5c2d7cc 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2470,6 +2470,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) struct file *fpin = NULL; pgoff_t offset = vmf->pgoff; + if (ra->ra_pages != inode_to_bdi(mapping->host)->ra_pages) + ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages; /* If we don't want any read-ahead, don't bother */ if (vmf->vma->vm_flags & VM_RAND_READ) return fpin;