On Thu, 2012-03-01 at 12:14 +0200, Sasha Levin wrote: > On Thu, Mar 1, 2012 at 9:01 AM, Amos Kong <akong@xxxxxxxxxx> wrote: > > This patch makes the kvm_io_range array can be resized dynamically. > > Set an upper bounds for kvm_io_range to limit userspace. > > 1000 is a very large limit and not bloat the typical user. > > Whats the reason for making everything dynamic? Memory savings there > aren't that significant. We're currently looking at about 14k for these arrays with 300 entries since we have two of them. If we're going to double it or triple it to handle the maximum use case, why impose that on the typical VM? It may not be multiple megabytes, but I wouldn't say it's insignificant either. > > If you want to make it more efficient just define: > static struct kvm_io_bus io_bus[2]; > > somewhere in kvm_main.c, and just switch between them when you need to > do insertion and removal of devices. You get the benefit of zero slub > usage, no allocations in any of the paths, and much simpler logic. It's updated via rcu. The change Amos is proposing is fairly trivial; allocate the necessary size and memcpy instead of memdup. Maybe it can be optimized further, but this seems like a step in the right direction to handle worst case use and, if anything, benefit the typical user too. Thanks, Alex -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html