[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] evtchn: double per-channel locking can't hit identical channels
commit 181f2c224ccd0a2900d6ae94ec390a546731f593 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Nov 25 14:08:14 2020 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Nov 25 14:08:14 2020 +0100 evtchn: double per-channel locking can't hit identical channels Inter-domain channels can't possibly be bound to themselves, there's always a 2nd channel involved, even when this is a loopback into the same domain. As a result we can drop one conditional each from the two involved functions. With this, the number of evtchn_write_lock() invocations can also be shrunk by half, swapping the two incoming function arguments instead. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> --- xen/common/event_channel.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 54b2e2550e..dbfba62a49 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -326,23 +326,18 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc) static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn) { - if ( lchn <= rchn ) - { - evtchn_write_lock(lchn); - if ( lchn != rchn ) - evtchn_write_lock(rchn); - } - else - { - evtchn_write_lock(rchn); - evtchn_write_lock(lchn); - } + ASSERT(lchn != rchn); + + if ( lchn > rchn ) + SWAP(lchn, rchn); + + evtchn_write_lock(lchn); + evtchn_write_lock(rchn); } static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn) { - if ( lchn != rchn ) - evtchn_write_unlock(lchn); + evtchn_write_unlock(lchn); evtchn_write_unlock(rchn); } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |