From patchwork Thu Oct 22 13:58:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Xu X-Patchwork-Id: 11851477 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 D32AA14B7 for ; Thu, 22 Oct 2020 13:59:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 105C024630 for ; Thu, 22 Oct 2020 13:59:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 105C024630 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 032CC6B0073; Thu, 22 Oct 2020 09:59:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F25886B0074; Thu, 22 Oct 2020 09:59:05 -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 E621A6B0075; Thu, 22 Oct 2020 09:59:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id B9B936B0073 for ; Thu, 22 Oct 2020 09:59:05 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 464598782FD9 for ; Thu, 22 Oct 2020 13:59:05 +0000 (UTC) X-FDA: 77399717850.27.stew02_55017c427251 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 323A63D668 for ; Thu, 22 Oct 2020 13:59:05 +0000 (UTC) X-Spam-Summary: 1,0,0,77bea0be52b63872,d41d8cd98f00b204,haoxu@linux.alibaba.com,,RULES_HIT:41:355:379:541:960:973:988:989:1260:1261:1345:1437:1534:1541:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:5007:6117:6261:7875:7901:7903:10004:11026:11232:11658:11914:12043:12296:12297:12438:12555:12663:12679:12895:13069:13161:13229:13311:13357:13618:14093:14096:14180:14181:14384:14394:14721:21060:21080:21324:21451:21627:21966:30012:30054:30070,0,RBL:115.124.30.57:@linux.alibaba.com:.lbl8.mailshell.net-62.20.2.100 64.201.201.201;04yrd4wbs4pt517xiifya6b8w6cf8opbn6qmxzx5cby3gn4suintrhuika1pfq7.cwgo4psjbfiwmqcqhzsnf8pzsu3amdtyhtwxzuqycky31oswdqczuus81rdf6ix.c-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: stew02_55017c427251 X-Filterd-Recvd-Size: 2756 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 22 Oct 2020 13:58:59 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=haoxu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UCqWeHm_1603375114; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:haoxu@linux.alibaba.com fp:SMTPD_---0UCqWeHm_1603375114) by smtp.aliyun-inc.com(127.0.0.1); Thu, 22 Oct 2020 21:58:51 +0800 From: Hao Xu To: Jens Axboe , io-uring@vger.kernel.org Cc: linux-mm@kvack.org, Johannes Weiner , Andrew Morton Subject: [PATCH RFC] mm: fix the sync buffered read to the old way Date: Thu, 22 Oct 2020 21:58:34 +0800 Message-Id: <1603375114-58419-1-git-send-email-haoxu@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.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: The commit 324bcf54c449 changed the code path of async buffered reads to go with the page_cache_sync_readahead() way when readahead is disabled, meanwhile the sync buffered reads are forced to do IO in the above way as well, which makes it go to a more complex code path. Fixes: 324bcf54c449 ("mm: use limited read-ahead to satisfy read") Signed-off-by: Hao Xu --- Hi Jens, I see it from the commit 324bcf54c449 ("mm: use limited read-ahead to satisfy read") that we have forced normal sync buffered reads go with the page_cache_sync_readahead() when readahead is disabled. I'm not sure if this is what you expected. Here I changed the sync buffered reads to go with the old code path(a_ops->readpage()), and tested the performance of them, the results of IOPS and cpu time are similar. I need your opinion on this. mm/filemap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index e4101b5bfa82..0b2a0f633c01 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2224,9 +2224,14 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, if (!page) { if (iocb->ki_flags & IOCB_NOIO) goto would_block; - page_cache_sync_readahead(mapping, - ra, filp, - index, last_index - index); + /* + * when readahead is disabled and IOCB_WAITQ isn't set + * we should go with the readpage() way. + */ + if (ra->ra_pages || (iocb->ki_flags & IOCB_WAITQ)) + page_cache_sync_readahead(mapping, + ra, filp, + index, last_index - index); page = find_get_page(mapping, index); if (unlikely(page == NULL)) goto no_cached_page;