On Fri, Jan 22, 2016 at 2:18 AM, Shaohua Li <[email protected]> wrote:

> Yes, I know a typical per-cpu cache algorithm will free entry to the
> per-cpu cache first. I didn't do it because it's not worthy in my test.
> We definitely should do it if it's worthy though. My point is we don't
> need implement the per-cpu that complicated. It could be simply:
>
> alloc:
>  - refill per-cpu cache if it's empty
>  - alloc from per-cpu cache
>
> free
>  - free to per-cpu cache
>  - if per-cpu cache hits threshold, free to global

It seems that in a workload in which a cpu does an alloc followed by a
free, this will access the global allocator every time, which makes
the cache useless.  The magazines algorithm we use solves these
thrashing problems, that's why it's slightly more complicated.  See
Section 3 in https://www.usenix.org/legacy/event/usenix01/bonwick.html
for details.

My point is that per-cpu caching of a global allocator is a well-known
problem with standard solutions, which our patch adopts.  We could
keep iterating here, but to solve all the issues that magazines solve,
we'll probably end up with similar complexity.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to