Hi Marvin, On 4/1/20 4:50 PM, Marvin Liu wrote: > If Tx zero copy enabled, gpa to hpa mapping table is updated one by > one. This will harm performance when guest memory backend using 2M > hugepages. Now add cached mapping table which will sorted by using > sequence. Address translation will first check cached mapping table, > then check unsorted mapping table if no match found. > > Signed-off-by: Marvin Liu <yong....@intel.com> >
I don't like the approach, as I think it could have nasty effects. For example, the system is loaded normally and let's say 25% of the pages are used. Then we have a small spike, and buffers that were never used start to be used, it will cause writing new entries into the cache in the hot path when it is already overloaded. Wouldn't it increase the number of packets dropped? At set_mem_table time, instead of adding the guest pages unsorted, maybe better to add them sorted there. Then you can use a better algorithm than linear searching (O(n)), like binary search (O(log n)). Thanks, Maxime