[lkml]   [2009]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Revert netlink ABI change to gnet_stats_basic
On Sunday 16 August 2009 19:36:49 Eric Dumazet wrote:
> In 5e140dfc1fe87eae27846f193086724806b33c7d "net: reorder struct Qdisc
> for better SMP performance" the definition of struct gnet_stats_basic
> changed incompatibly, as copies of this struct are shipped to
> userland via netlink.
> Restoring old behavior is not welcome, for performance reason.
> Fix is to use a private structure for kernel, and
> teach gnet_stats_copy_basic() to convert from kernel to user land,
> using legacy structure (struct gnet_stats_basic)

Are you sure that the packed structure is actually an advantage
for performance? On architectures that do not have unaligned stores
in hardware, the compiler will generate highly inefficient code
for accessing packed variables, in order to avoid alignment exceptions.

It would need some more measurements, but I'd guess that

struct gnet_stats_basic_packed
__u64 bytes __attribute__ ((packed, aligned(4)));
__u32 packets;

would give significantly better code on those architectures than
your version, while still giving you the 12-byte size.

Arnd <><

 \ /
  Last update: 2009-08-18 23:23    [W:0.313 / U:2.944 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site