Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3025375rwb; Mon, 15 Aug 2022 16:23:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR66RGqYjyeK4vWgWb1wzDvLb7pXZ+lASD88EZerQXrL7X7f4Fxp8TUupyYqzOkTPx+CsR7B X-Received: by 2002:a17:907:6d12:b0:731:8595:9784 with SMTP id sa18-20020a1709076d1200b0073185959784mr11678864ejc.323.1660605803445; Mon, 15 Aug 2022 16:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605803; cv=none; d=google.com; s=arc-20160816; b=p3OSOzLvB06yazj/iRD2mk0Q06LOFPWefFF/ugXISrymGxwl6y55eY/pV4EARh31vL odXmdnDRw/VaDSV/kLGh/2ZeXiNubNL6Z0UQP7Ra0hiH/wY9xZ3B22PL5Tu/rRqv2D8h FAUR8XDjfk/DFnb9Q0m26ZoqwCBDDKZFhsPtGr3o1B5Xqasycip5eD0vB47DxjwKxRKY kDElMojZw/4/nKRcrTyvz4+nrBKkYZwMFlb7MUTKDXa2sduFGntfOHeCjBEUG9SfzX3/ vNY4C5d4WLJD8jCnsD+I59TkPmsyjeI4/IJ3eiYGY/RN6zhdTcyKbrrDtElIaYRhxyK8 RAtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uKpruJzMxCwp/WnRtuD9nXA3iFuWBly0ICjSyAObk+I=; b=L9liwIsN14EzUxqcHokcv4gBo9yfM+QP8wqs6MbwKKBBWiPsU+7m6lJm3ilYTEcXmH gW23zrqgvCGtNYXGxkf5vdcfnJjskvGMDoaMiCyWjIDK3MQZ8VMP9NQPpkrY/Zib/4ow 3dG+JuSbPfYd/Adc6h6u56dS0aHEVx15+VJvdAWSnKEhzV56t8WcCrZiw6UBTvohB8bu F0ylziy3+FKWwBeT3Jw7tnj377aItir4uSm8s/YmwLYamOlfYRml7adS225JG40FViOP ehuWo9iAqARbT+a8w7YkaQK3Zp05DcdcUdsMRuJaLNFqV48paWXWc/4aBItGLnhFThfc 8bhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L09ghtYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd21-20020a1709069b9500b00732f76a97aasi9481484ejc.899.2022.08.15.16.22.58; Mon, 15 Aug 2022 16:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L09ghtYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346257AbiHOUuG (ORCPT + 99 others); Mon, 15 Aug 2022 16:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346250AbiHOUtX (ORCPT ); Mon, 15 Aug 2022 16:49:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1926B8F01; Mon, 15 Aug 2022 12:09:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9B1B60A52; Mon, 15 Aug 2022 19:09:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D16FAC433C1; Mon, 15 Aug 2022 19:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590552; bh=kuSPsuod3nFFBwRzP14Dq+MMwRDfrosp/7NOt14u+p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L09ghtYh5RaLjXMthYB/9GHF8azEJL9YIPE+iiErTqJ56ylsa1lNHfX9REhP0IVMH 6y4BqhjEPQLElFoLI2GdItUh6efEnYC+ooADw+BT+EOUgLhV+/HCb4B5MSPlQ8t8w2 IOqiyAeGHp4UFR7K1RMFTHa6ZttA0K50XHuUZC+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jinbao , Gao Xiang , Sasha Levin Subject: [PATCH 5.18 0265/1095] erofs: avoid consecutive detection for Highmem memory Date: Mon, 15 Aug 2022 19:54:24 +0200 Message-Id: <20220815180440.711719977@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang [ Upstream commit 448b5a1548d87c246c3d0c3df8480d3c6eb6c11a ] Currently, vmap()s are avoided if physical addresses are consecutive for decompressed buffers. I observed that is very common for 4KiB pclusters since the numbers of decompressed pages are almost 2 or 3. However, such detection doesn't work for Highmem pages on 32-bit machines, let's fix it now. Reported-by: Liu Jinbao Fixes: 7fc45dbc938a ("staging: erofs: introduce generic decompression backend") Link: https://lore.kernel.org/r/20220708101001.21242-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/decompressor.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 0e0d1fc0f130..9bbd9a59426b 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -93,14 +93,18 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_lz4_decompress_ctx *ctx, if (page) { __clear_bit(j, bounced); - if (kaddr) { - if (kaddr + PAGE_SIZE == page_address(page)) + if (!PageHighMem(page)) { + if (!i) { + kaddr = page_address(page); + continue; + } + if (kaddr && + kaddr + PAGE_SIZE == page_address(page)) { kaddr += PAGE_SIZE; - else - kaddr = NULL; - } else if (!i) { - kaddr = page_address(page); + continue; + } } + kaddr = NULL; continue; } kaddr = NULL; -- 2.35.1