From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54F5721638D for ; Wed, 17 Dec 2025 17:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765993299; cv=none; b=C2x7BLSOmpc1vFxF4lgwYH92X7dgz93dhn95QPWsop/2psBeheUDx/yYXlJZ1ZEMKZaoEzKD/gXhQ5riixeCwYo2sjebKIYS41I/cvHUvzL/1+OdPH5R46YUB1OGg4H/uQvPIY6Di18SHzT8bBvCJV5q+QFk+Bvz9yx0qXdO1yo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765993299; c=relaxed/simple; bh=SOW5kCSR2lCiMBasjXBaIxtfeHVUnjwHLKr7qpk9MF8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZoDg5TFt4gPe75uveA3GVxwPZRcqdlwek9tliM7AATP3wzCX94JK+mpiCzYSEnngHZjUEkSUIqMDpQxC5ehxBIhEy9tuhKt/1wbZIwXQChNQQbZMBHXnS+MTcBts1hYALoQKEMdwcSjm9WsJl2dbozz8IS4d5PS37lYb1PAnkcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tXhtYyYw; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tXhtYyYw" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-29f02651fccso2625ad.0 for ; Wed, 17 Dec 2025 09:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765993298; x=1766598098; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0ko2Pxs6NnyLM5kIutMq/1i8LefkDqSqGJgTXywJ7sM=; b=tXhtYyYw4yXDWh//JRo06kyULRPkp86WiDdVlwdzh5rcVorUtS6SMBIQrdmmkJNHIJ tWZmV68IQmCuRWwi6DIOx11aJ+w9jhSz3/5oC7Y7w+zRf3g9aG7sgp+NcwRiONpPcB7P psLCLTcooayP4iWDG+xaCkDvskXL42drzFnfWvL+oa97/fmogxyPeO6MWx0lS9v8k10O 3v6jM14Y2TtX0uQxx7AeG412VygPBymLQ1DjoMI3SexgvUrwYtm5DftCeAG3R6cmkxwX 9ESchWVugOO+jdZ/HZmZ9fbA9r0nUJSM1d9CPG4UAgZ95pu9JiFgRbIX0RiqaAN447bY mbfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765993298; x=1766598098; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0ko2Pxs6NnyLM5kIutMq/1i8LefkDqSqGJgTXywJ7sM=; b=SONTpvI6+IR0yEKSOcV2o47oIumkp7kWLeSpluV8439q+L8Ye0Q7dRf+SiQ64sqbWY 8ulZf7bxIujSiXkIKrfBxObVs22vDnbsdik+fNSlkotayAVuzQZsk+hgjwao29rpg5ZN 4jZ5Pi9mSyK7vfahy5t1NUb7RQTD6oPD5m6TU8YXDl4mcFl1mJ0LXbrUFB9BENARC0r/ dzNkNxU+WjO9DeQt40gOFUKC6IUnMeuxRLUbQOJZ86GGCq2zidLuC8m/eqnHrU095Ek+ iku/hFfrlidLdYCWbn7NvYSMEH8rfq+LuImg9BwFrKatCC5tHt3XYiRDGp3qzDLXe23G NxAg== X-Forwarded-Encrypted: i=1; AJvYcCWkfRHdgAt44uzEjy4a0DIcdsUmu9uHus+0gmsHzL+aFxHVGDhFdGKz4joIea8MSHZ9AIUiG/2+E20VEk8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8/Fig++FYybAUgnX0S918HyEwYrh4I31W//VIkRVqm1iLx3gr /O2PAqOT7EYxRX1T5rd0OwzjT6MTBxHqoqzWD7t+jTaMU5coylMUVz5X8iTV6PAOdQ== X-Gm-Gg: AY/fxX5eE/MoOrPQMFPUEJjNFj3u5fikGi5meRR04zK7+YfrtRRyDFASTi140qjIgEi VQCXe1mIBwwQepIl/6wxU2Wl/PG3CwOeyqTe53MXJNN0hloyGo6yEkx97SqQL/0KuZkJx5P9vGA 6cxPaKk4Y78FkUKyErzaU1Dax0RvK11JzQTb+Rx1s2WrFIcBeiP3cFo4nO8oSCCfTk+46hx8EMI aIk6uWbyrTseux2hTf1UZ2vTTxhNM099qqBHVgG9wkGZM0gQ4ylpLpN1uTD+HnjagbA51HoiE8j 8Gn4mJiM8FyWQuiLlCU3rzw/V2szNtbqf8C31MmrChoV3HCwBHYF6kuTZiNwiaUpBck1ovxnst4 +e1+aoEluWNsAj/qeebV1C/vFeMq4X3aiR6vZd6YFnKXlno1ocdJ4YorOqSFWVF5KQVaRKDAAUV lRWn/4llnt/Tk1eivmtOfWw7ISdm28HnT+no9/1Ry0gZNtqH2gu3rUZAo= X-Google-Smtp-Source: AGHT+IEd9G3ekrYqrJmnTQi97R/B7tko5ds/29G+nYWwbWP9z9Fmaib0nqToJib/Ijloiriilk958Q== X-Received: by 2002:a17:903:1c8:b0:2a1:3cda:8e99 with SMTP id d9443c01a7336-2a2061026dfmr2822485ad.21.1765993297126; Wed, 17 Dec 2025 09:41:37 -0800 (PST) Received: from google.com (99.181.125.34.bc.googleusercontent.com. [34.125.181.99]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7fe11856f78sm83292b3a.11.2025.12.17.09.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 09:41:36 -0800 (PST) Date: Wed, 17 Dec 2025 17:41:31 +0000 From: Sami Tolvanen To: Eric Biggers Cc: dm-devel@lists.linux.dev, Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Eran Messeri , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] dm-verity: move dm_verity_fec_io to mempool Message-ID: <20251217174131.GA2944334@google.com> References: <20251216230614.51779-1-ebiggers@kernel.org> <20251216230614.51779-2-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@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: <20251216230614.51779-2-ebiggers@kernel.org> On Tue, Dec 16, 2025 at 03:06:08PM -0800, Eric Biggers wrote: > Currently, struct dm_verity_fec_io is allocated in the front padding of > struct bio using dm_target::per_io_data_size. Unfortunately, struct > dm_verity_fec_io is very large: 3096 bytes when CONFIG_64BIT=y && > PAGE_SIZE == 4096, or 9240 bytes when CONFIG_64BIT=y && PAGE_SIZE == > 16384. This makes the bio size very large. > > Moreover, most of dm_verity_fec_io gets iterated over up to three times, > even on I/O requests that don't require any error correction: > > 1. To zero the memory on allocation, if init_on_alloc=1. (This happens > when the bio is allocated, not in dm-verity itself.) > > 2. To zero the buffers array in verity_fec_init_io(). > > 3. To free the buffers in verity_fec_finish_io(). > > Fix all of these inefficiencies by moving dm_verity_fec_io to a mempool. > Replace the embedded dm_verity_fec_io with a pointer > dm_verity_io::fec_io. verity_fec_init_io() initializes it to NULL, > verity_fec_decode() allocates it on the first call, and > verity_fec_finish_io() cleans it up. The normal case is that the > pointer simply stays NULL, so the overhead becomes negligible. > > Signed-off-by: Eric Biggers Reviewed-by: Sami Tolvanen Sami