From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] Avoid panic when adjusting sedf parameters Date: Thu, 17 Nov 2011 13:52:48 +0000 Message-ID: References: <4EC51A8D0200007800061933@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4EC51A8D0200007800061933@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich , Juergen Gross Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 17/11/2011 13:30, "Jan Beulich" wrote: > 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. Given the gcc ({}) construction, you could do a double-loop: for ( (_d) = rcu_dereference(domain_list); \ (_d) != NULL; \ ({ while ((_d) = rcu_dereference((_d)->next_in_list != NULL) if ((_d)->cpupool == (_c)) break; (_d); }) ) A bit ugly. ;-) And I still worry about cpupool locking... -- Keir