Re: [PATCH rdma-next] RDMA: Use __packed annotation instead of __attribute__ ((packed))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 25, 2019 at 06:54:07AM -0800, Bart Van Assche wrote:
> On 2/24/19 10:52 PM, Leon Romanovsky wrote:
> > diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h
> > index 476d4309576d..3d16d614aff6 100644
> > --- a/drivers/infiniband/core/cm_msgs.h
> > +++ b/drivers/infiniband/core/cm_msgs.h
> > @@ -98,7 +98,7 @@ struct cm_req_msg {
> >
> >   	u32 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE / sizeof(u32)];
> >
> > -} __attribute__ ((packed));
> > +} __packed;
>
> Hi Leon,
>
> A previous RDMA maintainer once wrote a blog in which he explained why it is
> better to apply the __packed attribute only to data members that need it
> instead of to data structures. The reason is that applying __packed to data
> structures does not allow compilers to generate optimal code for
> architectures that cannot perform non-aligned multi-byte reads efficiently.
> Does that concern apply to the data structures modified by this patch?

This specific patch doesn't change any functionality because __packed
and  __attribute__ ((packed)) are the same. If any concerns exist before
applying this patch, they will exist after too.

https://elixir.bootlin.com/linux/v5.0-rc8/source/include/linux/compiler_attributes.h#L220

Thanks

>
> Thanks,
>
> Bart.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux