On 2021-03-19 13:25, John Garry wrote:
Add a function to allow the max size which we want to optimise DMA mappings
for.
It seems neat in theory - particularly for packet-based interfaces that might have a known fixed size of data unit that they're working on at any given time - but aren't there going to be many cases where the driver has no idea because it depends on whatever size(s) of request userspace happens to throw at it? Even if it does know the absolute maximum size of thing it could ever transfer, that could be impractically large in areas like video/AI/etc., so it could still be hard to make a reasonable decision.
Being largely workload-dependent is why I still think this should be a command-line or sysfs tuneable - we could set the default based on how much total memory is available, but ultimately it's the end user who knows what the workload is going to be and what they care about optimising for.
Another thought (which I'm almost reluctant to share) is that I would *love* to try implementing a self-tuning strategy that can detect high contention on particular allocation sizes and adjust the caches on the fly, but I can easily imagine that having enough inherent overhead to end up being an impractical (but fun) waste of time.