Peter Xu <pet...@redhat.com> writes: > On Wed, Nov 01, 2023 at 02:20:32PM -0300, Fabiano Rosas wrote: >> I wonder if adapting multifd to use a QIOTask for the channels would >> make sense as an intermediary step. Seems simpler and would force us to >> format multifd in more generic terms. > > Isn't QIOTask event based, too? > > From my previous experience, making it not gcontext based, if we already > have threads, are easier. But maybe I didn't really get what you meant.
Sorry, I wasn't thinking about the context aspect. I agree it's easier without it. I was talking about having standardized dispatch and completion code for multifd without being a whole thread pool. So just something that takes a function and a pointer to data, runs that in a thread with some locking and returns in a sane way. Every thread we create in the migration code has a different mechanism to return after an error and a different way to do cleanup. The QIOTask seemed to fit that at a high level. I would be happy with just the return + cleanup part really. We've been doing work around those areas for a while. If we could reuse generic code for that it would be nice.