On Tue, 2019-05-28 at 12:32 +0200, Juergen Gross wrote: > In order to make it easy to iterate over sched_unit elements of a > domain build a single linked list and add an iterator for it. > How about a ',' between domain and build? > For completeness add another iterator for_each_sched_unit_vcpu() > which > will iterate over all vcpus if a sched_unit (right now only one). > This "over all vcpus of a sched_unit" ? > will be needed later for larger scheduling granularity (e.g. cores). > > Signed-off-by: Juergen Gross > One question: > @@ -279,8 +279,16 @@ struct vcpu > struct sched_unit { > struct vcpu *vcpu; > void *priv; /* scheduler private data */ > + struct sched_unit *next_in_list; > }; > > +#define for_each_sched_unit(d, > e) \ > + for ( (e) = (d)->sched_unit_list; (e) != NULL; (e) = (e)- > >next_in_list ) > + > +#define for_each_sched_unit_vcpu(i, > v) \ > + for ( (v) = (i)->vcpu; (v) != NULL && (v)->sched_unit == > (i); \ > + (v) = (v)->next_in_list ) > + > So, here... sorry if it's me not seeing it, but why the (v)->sched_unit == (i) check is necessary? Do we expect to put in the list of vcpus of a particular unit, vcpus that are in another unit? Regards -- Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <> (Raistlin Majere)