From: Robin Murphy <robin.murphy@arm.com>
To: Michael Kelley <mhklinux@outlook.com>,
Petr Tesarik <petrtesarik@huaweicloud.com>,
Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Will Deacon <will@kernel.org>, Nicolin Chen <nicolinc@nvidia.com>,
"open list:DMA MAPPING HELPERS" <iommu@lists.linux.dev>,
open list <linux-kernel@vger.kernel.org>
Cc: Roberto Sassu <roberto.sassu@huaweicloud.com>,
Petr Tesarik <petr.tesarik1@huawei-partners.com>
Subject: Re: [PATCH 1/1] swiotlb: extend buffer pre-padding to alloc_align_mask if necessary
Date: Mon, 18 Mar 2024 13:05:03 +0000 [thread overview]
Message-ID: <b4488238-0c05-4d06-a60d-10e00460ea98@arm.com> (raw)
In-Reply-To: <SN6PR02MB4157FB27CD890E9F29408926D4282@SN6PR02MB4157.namprd02.prod.outlook.com>
On 15/03/2024 2:53 am, Michael Kelley wrote:
[...]
>> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
>> index 86fe172b5958..8ce11abc691f 100644
>> --- a/kernel/dma/swiotlb.c
>> +++ b/kernel/dma/swiotlb.c
>> @@ -69,11 +69,13 @@
>> * @alloc_size: Size of the allocated buffer.
>> * @list: The free list describing the number of free entries available
>> * from each index.
>> + * @padding: Number of preceding padding slots.
>> */
>> struct io_tlb_slot {
>> phys_addr_t orig_addr;
>> size_t alloc_size;
>> unsigned int list;
>> + unsigned int padding;
>
> Even without the padding field, I presume that in
> 64-bit builds this struct is already 24 bytes in size so as
> to maintain 64-bit alignment for the orig_addr and
> alloc_size fields. If that's the case, then adding the
> padding field doesn't change the amount of memory
> required for the slot array. Is that correct? Both the
> "list" and "padding" fields contain only small integers,
> but presumably reducing their size from "int" to "short"
> wouldn't help except in 32-bit builds.
Technically I think we could shrink the whole thing down to 16 bytes*,
since just 24 bits of size should still be more than enough, with the
remaining 8 bits similarly plenty for a padding slot count. Depends if
we think the overall memory saving is worth the marginal extra
complexity of packing values into bitfields.
Thanks,
Robin.
* The relevance of SWIOTLB to 32-bit builds is primarily going to be for
PAE cases where phys_addr_t is still 64-bit.
prev parent reply other threads:[~2024-03-18 13:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 13:41 Petr Tesarik
2024-03-15 2:53 ` Michael Kelley
2024-03-15 12:26 ` Petr Tesařík
2024-03-15 14:59 ` Michael Kelley
2024-03-15 15:09 ` Petr Tesařík
2024-03-18 13:05 ` Robin Murphy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4488238-0c05-4d06-a60d-10e00460ea98@arm.com \
--to=robin.murphy@arm.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mhklinux@outlook.com \
--cc=nicolinc@nvidia.com \
--cc=petr.tesarik1@huawei-partners.com \
--cc=petrtesarik@huaweicloud.com \
--cc=roberto.sassu@huaweicloud.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®