From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F693C388F2 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 CCD7322249 for ; Thu, 22 Oct 2020 13:59:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCD7322249 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) Received: by kanga.kvack.org (Postfix, from userid 40) id F25886B0074; Thu, 22 Oct 2020 09:59:05 -0400 (EDT) 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-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-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; -- 1.8.3.1