On Thu, Jul 13, 2017 at 04:48:42PM +0800, Jason Wang wrote: > > > On 2017年07月12日 16:13, Peter Xu wrote: > >It is not wise to disgard all the IOTLB cache when cache size reaches > >max, but that's what we do now. A slightly better (but still simple) way > >to do this is, we just throw away the least recent used cache entry. > > > >This patch implemented MRU list algorithm for VT-d IOTLB. The main logic > >is to maintain a Most Recently Used list for the IOTLB entries. The hash > >table is still used for lookup, though a new list field is added to each > >IOTLB entry for a iotlb MRU list. For each active IOTLB entry, it's both > >in the hash table in s->iotlb, and also linked into the MRU list of > >s->iotlb_head. The hash helps in fast lookup, and the MRU list helps in > >knowing whether the cache is still hot. > > > >After we have such a MRU list, replacing all the iterators of IOTLB > >entries by using list iterations rather than hash table iterations. > > Any reason of doing this, I thought hashtable was even a little bit faster?
Could I ask why? I thought they are merely the same (when iterating all the items)? -- Peter Xu