tech-kern archive

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

Re: RFC: ALTQ caller refactor



Hi,

On 2016/03/08 1:26, Taylor R Campbell wrote:
>    Date: Mon, 7 Mar 2016 17:39:15 +0900
>    From: Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
>    Hmm..., sorry, I am confused. Just to confirm, m_tag needs metadata
>    (struct m_tag) in the front of m_tag data(e.g. in this case struct
>    altq_pktqttr), so both struct m_tag and sturct altq_pktattr are
>    necessary, I think. It is similar to malloc(len + sizeof(struct m_tag))
>    in m_tag_get().
>    Could you tell me about the reason which the addition of sizes may not
>    necessarily work in detail?
snip
> Presumably that is why this has not been a problem in practice.  But
> it is not hard to imagine an architecture where uint64_t requires
> 8-byte alignment even though pointers require only 4-byte alignment.
> E.g., it wouldn't surprise me if MIPS N32 or similar required this --
> pointers are 32-bit and need only 4-byte alignment but the native
> 64-bit words need 8-byte alignment.

Ahhh, sorry, I misread your last comment. Now I see. Thank you very
much for your such detailed comment!


> In any case, whether or not you change anything about the existing
> m_tag_get code or users, I suggest that you use the struct and
> container_of idiom in any new code.

Hmm, I will change the existing code bit by bit as I modify around
such codes. After this, I use the struct and container_of idiom which
you suggest.


Thanks,

-- 
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.

Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit

Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>


Home | Main Index | Thread Index | Old Index