[ovs-dev] [PATCH] datapath: Don't query time for every packet.

Ben Pfaff blp at nicira.com
Mon Jul 26 16:59:51 UTC 2010


On Fri, Jul 23, 2010 at 05:03:26PM -0700, Jesse Gross wrote:
> Rather than actually query the time every time a packet comes through,
> just store the current jiffies and convert it to actual time when
> requested.  GRE is the primary beneficiary of this because the traffic
> travels through the datapath twice.  This change reduces CPU utilization
> 3-4% with GRE.

Thanks for re-posting this.  It looks fine.

One change that I would find tempting would be to change
get_time_offset() to return the structure timespec instead of returning
it through a pointer, and then change the functions and structs that
have pointers to struct timespec to have actual "struct timespec"s in
them.  It is somewhat unusual to pass and return structs by value, but
the timespec_sub() interface shows that this form is used in the kernel.

Then callers could just pass "get_time_offset()" instead of NULL, and
this code in get_stats() could be dropped:

> +		if (!time_offset) {
> +			time_offset = &local_offset;
> +			get_time_offset(time_offset);
> +		}
> +

Anyway, it's a thought.




More information about the dev mailing list