[ovs-dev] [RFC PATCH 2/8] ofpacts_check: Remove unnecessary flow copying.

Rajahalme, Jarno (NSN - FI/Espoo) jarno.rajahalme at nsn.com
Mon Jun 24 15:26:52 UTC 2013


On Jun 20, 2013, at 23:36 , ext Ben Pfaff wrote:

> On Thu, Jun 20, 2013 at 05:26:17PM +0300, Jarno Rajahalme wrote:
>> 
>> Signed-off-by: Jarno Rajahalme <jarno.rajahalme at nsn.com>
> 
> I have mixed feelings here.  On one hand, it is nice to avoid a big
> copy in some cases (rare cases really).  But on the other hand I am
> not fond of interfaces that temporarily modify data, even if they
> change it back later, and the pitfalls of such an approach are more of
> a problem as threading comes into the picture (and we are currently in
> the midst of threading OVS).
> 
> What do you think?


I'm in favor of avoiding unnecessary copying of big data items. I guess my uneasiness limit would be crossed by taking in a const pointer and then casting and modifying the data anyway. So as long as the API is honest, and there is no need for a function to be re-entrant on the same data, I'm OK with functions modifying the data they are given.  The callers use this function with private data in stack, so I think there is very low risk of this being a threading problem.

It's you call I guess :-)

  Jarno




More information about the dev mailing list