[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] PATCH: 6/25: Avoid event loop wakups in remote driver
- From: Jim Meyering <jim meyering net>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [libvirt] PATCH: 6/25: Avoid event loop wakups in remote driver
- Date: Thu, 15 Jan 2009 15:19:39 +0100
"Daniel P. Berrange" <berrange redhat com> wrote:
> When going into the call() method, we temporarily disable the
> event wakup callback. The call() method is already processing
> any async messages which arrive, so letting the main event loop
> wakup here is inefficient, and indeed will block the main event
> loop on the mutex while the main thread is in call(). We really
> don't want that !
>
> remote_internal.c | 42 ++++++++++++++++++++++++++++++++++--------
> 1 file changed, 34 insertions(+), 8 deletions(-)
>
> Daniel
>
> diff --git a/src/remote_internal.c b/src/remote_internal.c
...
> +doCall (virConnectPtr conn, struct private_data *priv,
...
> +static int
> +call (virConnectPtr conn, struct private_data *priv,
> + int flags /* if we are in virConnectOpen */,
> + int proc_nr,
> + xdrproc_t args_filter, char *args,
> + xdrproc_t ret_filter, char *ret)
> +{
> + int rv;
> + /*
> + * Avoid needless wake-ups of the event loop in the
> + * case where this call is being made from a different
> + * thread than the event loop. These wake-ups would
> + * cause the event loop thread to be blocked on the
> + * mutex for the duration of the call
> + */
> + if (priv->watch >= 0)
> + virEventUpdateHandle(priv->watch, 0);
> +
> + rv = doCall(conn, priv,flags, proc_nr,
> + args_filter, args,
> + ret_filter, ret);
> +
> + if (priv->watch >= 0)
> + virEventUpdateHandle(priv->watch, VIR_EVENT_HANDLE_READABLE);
Looks fine. ACK.
At first I wondered if someday the incoming event-update-handle
type might be something other than VIR_EVENT_HANDLE_READABLE,
in which case you'd want to save the original before
doCall, and restore it afterward. Probably won't happen.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]