Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp747463imu; Tue, 20 Nov 2018 06:24:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/VAm2NY0YMgWRndraBoDIPfItG3N3asp9/eJ1XUc6hPwRkO9BMGkQXwPCCCnjsdu16zyGjS X-Received: by 2002:a17:902:9f89:: with SMTP id g9mr2455964plq.214.1542723862543; Tue, 20 Nov 2018 06:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542723862; cv=none; d=google.com; s=arc-20160816; b=tdWLcGTsj8/1+j1irCqjkw0Ghm4/ViI4OHmNja8jDo8l1vfJMUHsgvqMC9W99dFGKc QckJTGF30RIxtcZ6Ld/CPv2tPXZKjc7FjhD8vY5FqgkErgoyxkTnrudQ8wbNy/OznIze ZKnnMWizpWruTKAa0HmWljXCETaZRZVDHuds/VkazNiuTAymZHX62hfvn4LWPJDiOlWP 6184UHl+4wdC1jyyF50WetL4VHtrZ1u7cEqT/dwZOIu9Kcy3rpkX2yKPJRKvA8AiJkaa LGhrYI31ZXlSMV2woCqZ2kReK12Xc6rt/OpMCJDvYDCofdgpshb+SCrgBbF9a6viilts /H2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6/Gieo0HRsWABm5QgAqU9JbEsMilXdYYZ/W1rzLzWt4=; b=lS2CTO4hAl2cXkE3B7ZPcCVDeZG7FY8wm93qnOUggEfi09IRPDo6eNriQlwUFDo8tS 6yOwhlTvIYuYO5Fq3uOWMbA0cPdu/QcZb0E9779r9Gn0j5uevj3+b363miV1NBg2vggX qgH3SvaEwCox8mjCLUJs2ne6ysFTjzIWGs02io0r2c4JBBxsenkUQTThU0+fTm9gZXzZ HcK8337nfWo6WFMql6TRMXpHccmyu77cCxoMNgQPrSFHOni5KyYodJ7CzSKOE2XrUZbM Vps03iwkxWwDFAnU1p+MrmydzELN498hCREy9MzD1xDWIHi/5+gXKaIqCAbcVzSUHLf0 Dv5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si5488134plk.206.2018.11.20.06.24.03; Tue, 20 Nov 2018 06:24:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729797AbeKUAvg (ORCPT + 99 others); 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