|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] Avoid panic when adjusting sedf parameters
>>> On 17.11.11 at 14:03, Juergen Gross <juergen.gross@xxxxxxxxxxxxxx> wrote:
>--- a/xen/include/xen/sched.h Wed Nov 16 18:21:14 2011 +0000
>+++ b/xen/include/xen/sched.h Thu Nov 17 14:01:58 2011 +0100
>@@ -569,6 +569,12 @@ extern struct domain *domain_list;
> (_d) != NULL; \
> (_d) = rcu_dereference((_d)->next_in_list )) \
>
>+#define for_each_domain_in_cpupool(_d,_c) \
>+ for ( (_d) = rcu_dereference(domain_list); \
>+ (_d) != NULL; \
>+ (_d) = rcu_dereference((_d)->next_in_list )) \
Wouldn't this, up to here, simply be for_each_domain()?
>+ if ((_d)->cpupool == (_c))
This is dangerous - consider code like
if ( x )
for_each_domain_in_cpupool ()
function();
else
other_stuff;
which would now associate the else with the wrong (inner) if. One
possible solution that comes to mind would be
#define for_each_domain_in_cpupool(_d,_c) \
for_each_domain_in_cpupool (_d) \
if ((_d)->cpupool != (_c)) \
continue; \
else
but I think I had seen a more clever solution to this problem, but cannot
remember/locate it right now.
Jan
>+
> #define for_each_vcpu(_d,_v) \
> for ( (_v) = (_d)->vcpu ? (_d)->vcpu[0] : NULL; \
> (_v) != NULL; \
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|