Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp198397lqg; Fri, 1 Mar 2024 02:28:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/apZHckWO+KhlViB6/j4r1Cq5oMgvrQFl1H6DY+pUH2L/ri6Qt28qEa9fl2hTBPpFjWkKmEB7P216jx1LYtmAx9F1YvpakzR0+8ZorA== X-Google-Smtp-Source: AGHT+IEJJdkAwxPO21SlXaYEtvft4tnFdfMZK/2AdUb3wvJWKYdiFK7Zf/3lPg4jfKWCM9w+wiVS X-Received: by 2002:a05:6214:5653:b0:690:71e:c588 with SMTP id mh19-20020a056214565300b00690071ec588mr1119002qvb.62.1709288889569; Fri, 01 Mar 2024 02:28:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709288889; cv=pass; d=google.com; s=arc-20160816; b=nljMUOiSTuqN841S5XQuaX08sReswAZV6AdsFnrYS2K0GHqfUJ2XKiMWxVsSSWVcIW oOVlaNsxZbS4J70+KCzjBYnZauWPpXY66T51+lt/KOw6X+3NKaLDW2ACw6Hwj7CBOFwp Hu1hRxxIFThF+Nworm6R+zep5evHgUAaka42aDMZoWq2BTqrkS+II85zJRnmhBssh95W r6FAl9DGxkagfa6B/ggLqGdtq+0tRJEz0Ml0BuD8xhAmPcUOOz+xSq3yaSooVWHELi2Z kvcShjNc4UtTb88Ipfg1bbZ0Z/iiNCdntVgPH6n2pgorF4syJxq8DBthfIi6IHBryQo+ TqFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=8KlVSqkwkALTan2Eo7aja6jOGWYCCrg0snunkPu80CQ=; fh=yVGat1aCOV8OgMfB1raFDYsxySpjaXOtljMpkCgi6SU=; b=kW2Viad78glHDTvh0RfgQpkmxIQuCj1HaFqdXhX4Nz5y8auI5VzObm7bFs07v3SJnU hZ5P6a4xrvI6XXPIuTKHSaTVbTiM0izixg2kw5X6Tx4yZ4aUSbHlW65tnifwrgFBTR8l ubU9cgts+YlnTEeb/+ewdFjsxBMWJsQxk1BH1mbbr0bT2EBPIhG9RnIP2fIYb1nbfJ4B LKYCvaZGfy7CpBswRt0/1WLEoHoR8z4+UJqvJQ8Hn2y7ommj5WSqOoSN9K1DApKTtmbS 1NmJJV3JiGI1gI0+PD+HHkBBWUunmNm/AQuob09k8O0V5geCM06025QfyphIWHvAPuT3 guCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-crypto+bounces-2420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=QUARANTINE) header.from=apana.org.au Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kc8-20020a056214410800b00690083fcda3si3194064qvb.584.2024.03.01.02.28.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-crypto+bounces-2420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=QUARANTINE) header.from=apana.org.au Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F1F81C212A0 for ; Fri, 1 Mar 2024 10:28:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81F406BB24; Fri, 1 Mar 2024 10:27:58 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFE986BB21; Fri, 1 Mar 2024 10:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.6.53.87 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288878; cv=none; b=jl8MpyNDK8+2iSBDBusaHpbKCJrmZITG4ZePrExjwjsQh0Cy6QH/utW4PFrk8y9rRKaOOWFfOMpJ6i+s/8bMTitutjmHxQSCvm1Vca2GIbX0haw6edX6l6T/GOeukYtWB2Xq4N8XKEfLLbLfXoScpPjfaN1SsoEEToFzCmMF5+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288878; c=relaxed/simple; bh=iy39Q0PmbCSReLq/Ws6hOu/z5TtI9QjD98GQOJha/pY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ccYUvey7Q43tzrtwVpBcLKWQwm/ZkPpArFM1uX+Se0MuIzIrrf7Ujy8YXYOc/YNgaKDSW8kAgu82AaIQ1m+CktFXBgFPhntiVHSemZfZZd6xmTK3PcUOvAH6YcHNHCmiMHScfM2lV8bxGPEaP7SRIIsIQMG2Tfi9Ii/rCvAYFGM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au; spf=pass smtp.mailfrom=gondor.apana.org.au; arc=none smtp.client-ip=144.6.53.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gondor.apana.org.au Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1rg07D-002H41-In; Fri, 01 Mar 2024 18:27:44 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 01 Mar 2024 18:27:58 +0800 Date: Fri, 1 Mar 2024 18:27:58 +0800 From: Herbert Xu To: Barry Song <21cnbao@gmail.com> Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, hannes@cmpxchg.org, chriscli@google.com, chrisl@kernel.org, sjenning@redhat.com, vitaly.wool@konsulko.com, Barry Song , Nhat Pham , Yosry Ahmed , Chengming Zhou , Matthew Wilcox , Kent Overstreet , "Darrick J. Wong" , Christoph Hellwig , Al Viro Subject: Re: [PATCH v6] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem Message-ID: References: <20240222020617.31041-1-21cnbao@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240222020617.31041-1-21cnbao@gmail.com> On Thu, Feb 22, 2024 at 03:06:17PM +1300, Barry Song wrote: > > - scatterwalk_map_and_copy(scratch->src, req->src, 0, req->slen, 0); > + if (sg_nents(req->src) == 1 && !PageHighMem(sg_page(req->src))) { > + src = page_to_virt(sg_page(req->src)) + req->src->offset; Incidentally this made me look at other uses of PageHighMem in the kernel. The one in copy_page_from_iter_atomic looks buggy because it assumes that the kmap never maps a page if PageHighMem is false, which is not the case for CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP. > @@ -152,8 +165,12 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir) > ret = -ENOSPC; > goto out; > } > - scatterwalk_map_and_copy(scratch->dst, req->dst, 0, req->dlen, > - 1); > + if (dst == scratch->dst) { > + scatterwalk_map_and_copy(scratch->dst, req->dst, 0, > + req->dlen, 1); > + } else { > + flush_dcache_page(sg_page(req->dst)); I think this is still wrong for the > PAGE_SIZE case. The existing code flushes each page sequentially but the new code only flushes the first page. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt