From nobody Fri Sep 5 20:24:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C090C32772 for ; Tue, 23 Aug 2022 11:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357425AbiHWLSb (ORCPT ); Tue, 23 Aug 2022 07:18:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357565AbiHWLQG (ORCPT ); Tue, 23 Aug 2022 07:16:06 -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 9EE80BD104; Tue, 23 Aug 2022 02:19:49 -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 7A7A361228; Tue, 23 Aug 2022 09:19:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED9CC433C1; Tue, 23 Aug 2022 09:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246375; bh=NhE0F3P1YJzIxv1DXafKxFY9WtmZk3vNc9SJfc+eUL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xtxqn3UXquMVbW5SrXiZMepkVLnjJ/bf6L3F707T1aRz9gWasLjVSayZTE++RpQFa mJ6sxbS7hFkeVEZtmGqLQnRQdRp/3h2Sihz+4zXFLkR5Kr5T1CkMlh+K8NiuZzXbme rDi8XPm2H2vZL+ytWlfT58qVBWg+ruJmrc6bZO58= 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.4 089/389] erofs: avoid consecutive detection for Highmem memory Date: Tue, 23 Aug 2022 10:22:47 +0200 Message-Id: <20220823080119.341036548@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 backe= nd") Link: https://lore.kernel.org/r/20220708101001.21242-1-hsiangkao@linux.alib= aba.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 23b74b8e8f96..38eeec5e3032 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -56,14 +56,18 @@ static int z_erofs_lz4_prepare_destpages(struct z_erofs= _decompress_req *rq, =20 if (page) { __clear_bit(j, bounced); - if (kaddr) { - if (kaddr + PAGE_SIZE =3D=3D page_address(page)) + if (!PageHighMem(page)) { + if (!i) { + kaddr =3D page_address(page); + continue; + } + if (kaddr && + kaddr + PAGE_SIZE =3D=3D page_address(page)) { kaddr +=3D PAGE_SIZE; - else - kaddr =3D NULL; - } else if (!i) { - kaddr =3D page_address(page); + continue; + } } + kaddr =3D NULL; continue; } kaddr =3D NULL; --=20 2.35.1