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=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 17820C18DF5 for ; Tue, 20 Nov 2018 14:22:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0911206B2 for ; Tue, 20 Nov 2018 14:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0911206B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729810AbeKUAvg (ORCPT ); Tue, 20 Nov 2018 19:51:36 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:40603 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726916AbeKUAvf (ORCPT ); Tue, 20 Nov 2018 19:51:35 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 454231C73BE48; Tue, 20 Nov 2018 22:22:11 +0800 (CST) Received: from localhost.localdomain (10.175.124.28) by smtp.huawei.com (10.3.19.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 20 Nov 2018 22:22:01 +0800 From: Gao Xiang To: Greg Kroah-Hartman , CC: LKML , , "Chao Yu" , Miao Xie , , Gao Xiang Subject: [PATCH 09/10] staging: erofs: decompress asynchronously if PG_readahead page at first Date: Tue, 20 Nov 2018 22:34:24 +0800 Message-ID: <20181120143425.43637-10-gaoxiang25@huawei.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181120143425.43637-1-gaoxiang25@huawei.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the case of nr_to_read == lookahead_size, it is better to decompress asynchronously as well since no page will be needed immediately. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- drivers/staging/erofs/unzip_vle.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c index a1376f3c6065..824d2c12c2f3 100644 --- a/drivers/staging/erofs/unzip_vle.c +++ b/drivers/staging/erofs/unzip_vle.c @@ -1344,8 +1344,8 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp, { struct inode *const inode = mapping->host; struct erofs_sb_info *const sbi = EROFS_I_SB(inode); - const bool sync = __should_decompress_synchronously(sbi, nr_pages); + bool sync = __should_decompress_synchronously(sbi, nr_pages); struct z_erofs_vle_frontend f = VLE_FRONTEND_INIT(inode); gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL); struct page *head = NULL; @@ -1363,6 +1363,13 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp, prefetchw(&page->flags); list_del(&page->lru); + /* + * A pure asynchronous readahead is indicated if + * a PG_readahead marked page is hitted at first. + * Let's also do asynchronous decompression for this case. + */ + sync &= !(PageReadahead(page) && !head); + if (add_to_page_cache_lru(page, mapping, page->index, gfp)) { list_add(&page->lru, &pagepool); continue; -- 2.14.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: gaoxiang25@huawei.com (Gao Xiang) Date: Tue, 20 Nov 2018 22:34:24 +0800 Subject: [PATCH 09/10] staging: erofs: decompress asynchronously if PG_readahead page at first In-Reply-To: <20181120143425.43637-1-gaoxiang25@huawei.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> Message-ID: <20181120143425.43637-10-gaoxiang25@huawei.com> For the case of nr_to_read == lookahead_size, it is better to decompress asynchronously as well since no page will be needed immediately. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- drivers/staging/erofs/unzip_vle.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c index a1376f3c6065..824d2c12c2f3 100644 --- a/drivers/staging/erofs/unzip_vle.c +++ b/drivers/staging/erofs/unzip_vle.c @@ -1344,8 +1344,8 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp, { struct inode *const inode = mapping->host; struct erofs_sb_info *const sbi = EROFS_I_SB(inode); - const bool sync = __should_decompress_synchronously(sbi, nr_pages); + bool sync = __should_decompress_synchronously(sbi, nr_pages); struct z_erofs_vle_frontend f = VLE_FRONTEND_INIT(inode); gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL); struct page *head = NULL; @@ -1363,6 +1363,13 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp, prefetchw(&page->flags); list_del(&page->lru); + /* + * A pure asynchronous readahead is indicated if + * a PG_readahead marked page is hitted at first. + * Let's also do asynchronous decompression for this case. + */ + sync &= !(PageReadahead(page) && !head); + if (add_to_page_cache_lru(page, mapping, page->index, gfp)) { list_add(&page->lru, &pagepool); continue; -- 2.14.4