2017-06-13 10:19:06

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] iommu/vt-d: constify intel_dma_ops.

File size before:
text data bss dec hex filename
32765 758 1824 35347 8a13 drivers/iommu/intel-iommu.o

File size After adding 'const':
text data bss dec hex filename
32925 598 1824 35347 8a13 drivers/iommu/intel-iommu.o

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/iommu/intel-iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 90ab011..de0df48 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3970,7 +3970,7 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)
return !dma_addr;
}

-struct dma_map_ops intel_dma_ops = {
+const struct dma_map_ops intel_dma_ops = {
.alloc = intel_alloc_coherent,
.free = intel_free_coherent,
.map_sg = intel_map_sg,
--
1.9.1


2017-06-28 08:53:32

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH] iommu/vt-d: constify intel_dma_ops.

On Tue, Jun 13, 2017 at 03:48:34PM +0530, Arvind Yadav wrote:
> File size before:
> text data bss dec hex filename
> 32765 758 1824 35347 8a13 drivers/iommu/intel-iommu.o
>
> File size After adding 'const':
> text data bss dec hex filename
> 32925 598 1824 35347 8a13 drivers/iommu/intel-iommu.o

What is the point of those commit-messages? They just show that the
struct moved from data to the text segment. The overall size doesn't
change much.



Joerg

2017-06-28 10:02:06

by Arvind Yadav

[permalink] [raw]
Subject: Re: [PATCH] iommu/vt-d: constify intel_dma_ops.

Hi,

Most dma_map_ops structures are never modified. Constify these
structures such that these can be write-protected. This file size diff
will show the difference between data and text segment.

Thanks,
~arvind

On Wednesday 28 June 2017 02:23 PM, Joerg Roedel wrote:
> On Tue, Jun 13, 2017 at 03:48:34PM +0530, Arvind Yadav wrote:
>> File size before:
>> text data bss dec hex filename
>> 32765 758 1824 35347 8a13 drivers/iommu/intel-iommu.o
>>
>> File size After adding 'const':
>> text data bss dec hex filename
>> 32925 598 1824 35347 8a13 drivers/iommu/intel-iommu.o
> What is the point of those commit-messages? They just show that the
> struct moved from data to the text segment. The overall size doesn't
> change much.
>
>
>
> Joerg
>

2017-06-28 10:20:10

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH] iommu/vt-d: constify intel_dma_ops.

On Wed, Jun 28, 2017 at 03:31:16PM +0530, Arvind Yadav wrote:
> Most dma_map_ops structures are never modified. Constify these
> structures such that these can be write-protected. This file size diff
> will show the difference between data and text segment.

I know what the diff shows, but it doesn't matter for this patch because
thats just an implementation detail of the compiler. The real reason for
making it 'const' is to write-protect them, and that should be clear in
the commit-message.


Joerg