Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp531655lqp; Wed, 12 Jun 2024 08:39:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtmOvx8h3V6rtrrILWG2GD7S72eF68pLvUKlyID/MAfdI2YL64vIDRWqKWWOFrsiBVfpFhc2xMzsQHOhmoIQWhD1I9kL0/nhLQrc6oxw== X-Google-Smtp-Source: AGHT+IHnncScskiKbsoOiCS5RxrliWzAbjG1LHQlOXKpSfZzzniXcFIo5FB5N+wyTnqEls55HD9X X-Received: by 2002:a05:622a:164b:b0:43a:ed8b:75b1 with SMTP id d75a77b69052e-4415ac52621mr23248321cf.43.1718206781440; Wed, 12 Jun 2024 08:39:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718206781; cv=pass; d=google.com; s=arc-20160816; b=JJ1oQNlQ2tmYPjm8afxbCOQX10rAG0NyVxiXteJ77PH8yWSolHcgPSfhV05zcsmchZ YJoJGu05ZOYQi+mAazw/yyk/HyYNMWIfBbFU17B70ZxA2F7rUHjhMmR7zXg8k7/flHjv RxkCIQeks7dDGWCc7ds7Se/0TyfpfBBAcJtjQW4WgUhwZ116sJJevLtTUCN/CAKP1Itd Mv1U1V9c4xmGOphyXnu1qux9w3YVksoqjc0GvAQelV6553mV0gppx01ljCH9hLzjENpP p/RrQS7nMzHErOSqsXxSeGKYytAV1wryW0bXNS3PikLyxEyseVFUKYbvOp+MRubWEA8R B8IQ== 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:dkim-signature; bh=V4ZZpNsNwwD2u/9JyLmnxreTEErTtNRajeg3OYXM8m4=; fh=PhjcRUevoInpMasAa/8hoLgoaNjfou5FLS3vcqu9Nww=; b=cbVH08ZY3qGrvarhFnx62tGRfUpnhCOns3lwO8snBHW6lefs5ZG+jO1Hul65uRcn/0 hFJ7EPEmWgYCgYeYsb7TuC/xzM950mr/PE76+Z47mUe+v5n+l7261WUzp1Yr2ez36cnZ jE3d5ShcbBZ1yJYp1oFoS5JIYPHm6b3W+rPdFXmFwLPBixd/krVR24ZMCBSp8weDSya+ SvH72pJhH3VH1Z62KqfAFpo3m8Di3FyFU5nbyXYIonQpg0mMRQ9XDUj6vKek/t+0SKfB pbWWhXZW1chEyFYQK83dwLEbgSKgRBALhUEs8x8e+G1nGv6qVk0H11DDuj23ajLC/hC7 2zgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AT6C4Fg7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4920-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44156b5a352si31047681cf.451.2024.06.12.08.39.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 08:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4920-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AT6C4Fg7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4920-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 38FDA1C23244 for ; Wed, 12 Jun 2024 15:38:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACA4B180A68; Wed, 12 Jun 2024 15:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AT6C4Fg7" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 63921180A65; Wed, 12 Jun 2024 15:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718206711; cv=none; b=XKe2nHo+qQ9tP2S4gLwUBkezVnvnUWuoIh42W5sDi6O3O6E9SDpQx+5GPOCcbHQzF9AgSzI7wImg/IQyqEzf3PJ4BHtdGOW86r28Vgn1FA5ZckdYE/C/NrYbELzT+dLsPmT4KhYyJtOWVwNTHL0+jLCd9hbjTSDiB2cEP2xa4WE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718206711; c=relaxed/simple; bh=g55WUS79UqWb2vcT2SLnwjgCqvRpBv4jwQTnch6tqy8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nSOQis1SKiivC1ufqcvuuWtv/C7UTHQk4CyspFqJV+kvZY0xubxWJ7Jvfa0wXif82U4o4ZS5WibtTZ9lWaMs2LqXVre40eIBSRo9djSRWcYCvDzlULkUljo+zZWH0liGCgCZfjp27Cas+7C3l5Lgbi6O7rghrq+p0SA/rIGmp5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AT6C4Fg7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A13C8C116B1; Wed, 12 Jun 2024 15:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718206711; bh=g55WUS79UqWb2vcT2SLnwjgCqvRpBv4jwQTnch6tqy8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AT6C4Fg7PnFDHKkPaxNGpuWF4djK2aMRuhJAoJFr/3nq5R3PbOHQZgCPRPaBU/UwK pXXuri4ppxubt4AtO57Xd8VY4fR7Af+9k6mumd31OFnGEW4e+olv1buTFfCm0QJ+pC kQnjLpI8sSQqeE7pdFeDOqhUaMpQBPV4JteDQug3RyZaYdWJie6YnMF54KxuPOYPNY KJhQwiWbmZcCx+cICN6dXIqR5CN0//8SrE6lxxeW0bqY9oP0sYFg8UqsA9ORONvuxH x0H4rRnvZngxQ/MqD1ENi0nLGldcjf7Po+TjTHsWA0vUjUaaN+XSNgNGE0JmiTebO3 ODeQC/TnUFehg== Date: Wed, 12 Jun 2024 08:38:29 -0700 From: Eric Biggers To: Herbert Xu Cc: linux-crypto@vger.kernel.org, fsverity@lists.linux.dev, dm-devel@lists.linux.dev, x86@kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Sami Tolvanen , Bart Van Assche Subject: Re: [PATCH v5 15/15] dm-verity: improve performance by using multibuffer hashing Message-ID: <20240612153829.GC1170@sol.localdomain> References: <20240611034822.36603-1-ebiggers@kernel.org> <20240611034822.36603-16-ebiggers@kernel.org> 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: On Wed, Jun 12, 2024 at 05:31:17PM +0800, Herbert Xu wrote: > On Mon, Jun 10, 2024 at 08:48:22PM -0700, Eric Biggers wrote: > > > > + if (++io->num_pending == v->mb_max_msgs) { > > + r = verity_verify_pending_blocks(v, io, bio); > > + if (unlikely(r)) > > + goto error; > > } > > What is the overhead if you just let it accumulate as large a > request as possible? We should let the underlying algorithm decide > how to divide this up in the most optimal fashion. > The queue adds 144*num_messages bytes to each bio. It's desirable to keep this memory overhead down. So it makes sense to limit the queue length to the multibuffer hashing interleaving factor. Yes we could build something where you could get a marginal performance benefit from amounts higher than that by saving indirect calls, but I think it wouldn't be worth bloating the per-IO memory. Another thing to keep in mind is that with how the dm-verity code is currently structured, for each data block it gets the wanted hash from the Merkle tree (which it prefetched earlier) before hashing the data block. So I also worry that if we wait too long before starting to hash the data blocks, dm-verity will spend more time unnecessarily blocked on waiting for Merkle tree I/O. - Eric