[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHsH6GtLkHV7NgPapcD7SxZvCa=NdzSo41N7VBQLCFOVeKunLw@mail.gmail.com>
Date: Thu, 26 Feb 2015 15:21:15 +0200
From: Eyal Birger <eyal.birger@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: "davem@...emloft.net" <davem@...emloft.net>,
"willemb@...gle.com" <willemb@...gle.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"shmulik.ladkani@...il.com" <shmulik.ladkani@...il.com>,
"marcel@...tmann.org" <marcel@...tmann.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/7] net: bluetooth: compact struct bt_skb_cb by
converting boolean fields to bit fields
Hi,
On Thu, Feb 26, 2015 at 1:31 PM, David Laight <David.Laight@...lab.com> wrote:
> From: Eyal Birger
>> On 64 bit systems, struct bt_skb_cb size is padded by 6 bytes in order
>> to reach 8 byte alignment.
>> Convert boolean fields force_active, incoming and req_start to bit fields
>> in order to eliminate the padding.
> ...
>> +++ b/include/net/bluetooth/bluetooth.h
> ...
>> struct bt_skb_cb {
>> __u8 pkt_type;
>> - __u8 incoming;
>> __u16 opcode;
>> __u16 expect;
>> - __u8 force_active;
>> - bool req_start;
>> + __u8 force_active:1;
>> + __u8 incoming:1;
>> + __u8 req_start:1;
>> u8 req_event;
>> hci_req_complete_t req_complete;
>> struct l2cap_chan *chan;
>
> You've generated some pad bytes, best to put everything on its natural alignment.
> The old version had req_complete at offset 9, the new one at offset 8.
> Not sure how this removes 6 bytes of pad.
>
Hmm, I tried different variations here. At a certain point, I had 6
bytes of padding.
Seems pahole is playing peekaboo on my holes :)
Anyway, since req_complete has to be pointer aligned, it does not
reside at offset 9,
but at offset 16, which creates a hole.
Thanks. I will update appropriately in v2.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists