From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 0702032721A for ; Wed, 19 Nov 2025 13:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763559380; cv=none; b=rpvllqpnaZTT09gVubzkGOuyN+Nys9CGoBG9upImURQefqxVHe6n/Xjrh68FXzjj2is0GnqKNz8rM/4eEuvRacdkTf9KjjgfO2Cw5XZUYdmxeY2NsBrR9dahtMc5zcg0FZk5xJVHPmdHBBeO4SN23Rz/DbRJ7AdW/z+dIxJOxpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763559380; c=relaxed/simple; bh=NES7ghcCP3m1ExfoU/vAhaTBSd5OHINmQXVjgEbzWRc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BpA2s9+O4i69xqRzG0SivsPWU4fF16jtzn7HW46WX9erepT04raltgWTqFdVAmg74VAPUiYIOgdS8fLrhd7Pp/PpMQ8b2UDNSYF18eHCaaNv42DJERC7z5AHwoe5GgNmxO3NAoyGCuipyrM5Ksih8IJAgIU4B+V+rKkfz/Lzq/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aPMKhCJs; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aPMKhCJs" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-47796a837c7so28703095e9.0 for ; Wed, 19 Nov 2025 05:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763559377; x=1764164177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=c7Vh9iH410ocW2kXRvDe/advl/kXNqnUGcQOJSCBMWA=; b=aPMKhCJsOa4CIu7MSY5XLAVo/IFxiUZLkb+BjsMVPj2GaPEdhmsBK4qOFB7/JvTL3U SLNTHS8HwSQe810mcdC91TTBJNWyK9I02561CrCzpS/H9rlJuz/hvrgS3vJV2krHUYhW Av60yvxhfm3g3aJSpVeroGHvj14GJ43xijwIjYW62QgkecohOGoRQqEvDz8Y6A10DXPr JtxT7bjGhtNa2j5i01iInPqp0amjta1lQTQfsDf78b3J8L1+uy1luJ3cJ479Rvksc5WP y0kqyZPCIg+hb4LbEQFK/T7aZCTrmRKDOfAoAxIACfDf6ri8H/T/e3Hqh87Ohn7UqVX8 bOww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763559377; x=1764164177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=c7Vh9iH410ocW2kXRvDe/advl/kXNqnUGcQOJSCBMWA=; b=B0IkFxPtgEk9wJRAOfu/JskzqezM0owQJh0VBnxqEPdWLd2eLKYy/LMPgkjSyQ43Wh aggqvLxKQ1wgLuCh2rNDAAwGHuQPQfePN83mkcMHfFGKjLI0Sx85e3ON6OvQkGJS/KyE TX2q43nQNWCaHDx55SgpZ35CpAOus9w4OSoc8WJpsgw23bCTr21ozrxL9Is1uhsXKJCC yHBp0xAaLhYv9GYW78A3M8JpVLZ4fj7jJeORogB2zUgz1PLXGV3Bpxv77T0v+95G1bQT pqfjW+oQoDz6m4wqg43God6DP6sHvy1/GzFdxFxHC2mtnzNe6VGyG/cYjhucjFpQB7Pk qdYg== X-Forwarded-Encrypted: i=1; AJvYcCUR4GeHQcqzTJXWjt6Yzy+3grmFrwpUe3bUmMiUPGi1eN13Tom554h0UXQv6Su0iBm89TbSMBCn8wfUd+w=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9qyr/lOe+f1hbUjRzZg68fmwH8yeH5GforC5z1ra8f4JTnnSC S0bQRFZ7CqcLbJ9yIDUgu7af/WDVg5e1RnD90DFnG6c3VQyo40ngeAo7 X-Gm-Gg: ASbGnctfV0RS0TKN8eeH0gWe1G8spO4CD5S8UDRCwhxOArLsOp6GPLYAUXlJDuY1TMd LyXpMxnHvA/urtCfEvGII9kFbbDatozjPZwSh+63vVHSCMOYwDGDYTnfhb0iATuSXqxUUJqMJ0M fl1nczd92EtnYCkwCuDxqTtxXlh+dBXTku/MMQWt094FeMpElXM7lYmnKLDUzhyFhgZq9IPJPdz vhsjJVu9mfsUwDHb8KAg/BF9oWACPsZGhXaHgrADjz/COHKVKMNXd7iOfi8SxFGwGy9FEKW08Do reegpNR85MZuev3T1rR3bzp/FcrCuBV0djeKOTyZFoHuFvkVqId4Q11kLypthlYA1SC1LYq4JBz nN3vW+3ntS0OHyF9PCjf6cH/AFRdbMWj5PqxZd09WjqsyJfocLQMoF6owNXG4160+s+jfI9CtSj KEA4GoVhCkHBM9p1AYl/+YxoGvAJlIS34o41Ugjmwbbp105M+tfOvT91RiB3b7GZQ= X-Google-Smtp-Source: AGHT+IE3Y1AoF6Zbsj6EnPiZSX/ljTgCnU9UJMmTnq9iwUTestBp2d1ByiGJgV/xm8MwNcR4oa6vPw== X-Received: by 2002:a05:600c:3ba8:b0:471:9da:524c with SMTP id 5b1f17b1804b1-477b198ca22mr26146925e9.12.1763559376963; Wed, 19 Nov 2025 05:36:16 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477b1012a92sm49026715e9.4.2025.11.19.05.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 05:36:16 -0800 (PST) Date: Wed, 19 Nov 2025 13:36:15 +0000 From: David Laight To: Leon Romanovsky Cc: Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Chaitanya Kulkarni Subject: Re: [PATCH v2 1/2] nvme-pci: Use size_t for length fields to handle larger sizes Message-ID: <20251119133615.2eefb7db@pumpkin> In-Reply-To: <20251119095516.GA13783@unreal> References: <20251117-nvme-phys-types-v2-0-c75a60a2c468@nvidia.com> <20251117-nvme-phys-types-v2-1-c75a60a2c468@nvidia.com> <20251118050311.GA21569@lst.de> <20251119095516.GA13783@unreal> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Wed, 19 Nov 2025 11:55:16 +0200 Leon Romanovsky wrote: > On Tue, Nov 18, 2025 at 06:03:11AM +0100, Christoph Hellwig wrote: > > On Mon, Nov 17, 2025 at 09:22:43PM +0200, Leon Romanovsky wrote: > > > From: Leon Romanovsky > > > > > > This patch changes the length variables from unsigned int to size_t. > > > Using size_t ensures that we can handle larger sizes, as size_t is > > > always equal to or larger than the previously used u32 type. > > > > > > Originally, u32 was used because blk-mq-dma code evolved from > > > scatter-gather implementation, which uses unsigned int to describe length. > > > This change will also allow us to reuse the existing struct phys_vec in places > > > that don't need scatter-gather. > > > > > > Signed-off-by: Leon Romanovsky > > > Reviewed-by: Chaitanya Kulkarni > > > --- > > > block/blk-mq-dma.c | 8 ++++++-- > > > drivers/nvme/host/pci.c | 4 ++-- > > > 2 files changed, 8 insertions(+), 4 deletions(-) > > > > > > diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c > > > index e9108ccaf4b0..e7d9b54c3eed 100644 > > > --- a/block/blk-mq-dma.c > > > +++ b/block/blk-mq-dma.c > > > @@ -8,7 +8,7 @@ > > > > > > struct phys_vec { > > > phys_addr_t paddr; > > > - u32 len; > > > + size_t len; > > > }; > > > > So we're now going to increase memory usage by 50% again after just > > reducing it by removing the scatterlist? > > It is slightly less. > > Before this change: 96 bits Did you actually look? There will normally be 4 bytes of padding at the end of the structure. About the only place where it will be 12 bytes is a 32bit system with 64bit phyaddr that aligns 64bit items on 32bit boundaries - so x86. David > After this change (on 64bits system): 128 bits. > > It is 33% increase per-structure. > > So what is the resolution? Should I drop this patch or not? > > Thanks >