linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
	konrad.wilk@oracle.com, david.vrabel@citrix.com,
	boris.ostrovsky@oracle.com
Subject: Re: [Patch V2] xen: release lock occasionally during ballooning
Date: Mon, 20 Jul 2015 13:48:22 +0200	[thread overview]
Message-ID: <55ACE006.4000507@suse.com> (raw)
In-Reply-To: <1437392794-6372-1-git-send-email-jgross@suse.com>

Please ignore, forgot stg refresh...

Juergen

On 07/20/2015 01:46 PM, Juergen Gross wrote:
> When dom0 is being ballooned balloon_process() will hold the balloon
> mutex until it is finished. This will block e.g. creation of new
> domains as the device backends for the new domain need some
> autoballooned pages for the ring buffers.
>
> Avoid this by releasing the balloon mutex from time to time during
> ballooning. Adjust the comment above balloon_process() regarding
> multiple instances of balloon_process().
>
> Instead of open coding it, just use cond_resched().
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>   drivers/xen/balloon.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index fd93369..e6d9eee 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -481,9 +481,16 @@ static void balloon_process(struct work_struct *work)
>   {
>   	enum bp_state state = BP_DONE;
>   	long credit;
> +	static bool active;
>
>   	mutex_lock(&balloon_mutex);
>
> +	if (active) {
> +		mutex_unlock(&balloon_mutex);
> +		return;
> +	}
> +	active = true;
> +
>   	do {
>   		credit = current_credit();
>
> @@ -499,12 +506,16 @@ static void balloon_process(struct work_struct *work)
>
>   		state = update_schedule(state);
>
> -#ifndef CONFIG_PREEMPT
> -		if (need_resched())
> -			schedule();
> -#endif
> +		mutex_unlock(&balloon_mutex);
> +
> +		cond_resched();
> +
> +		mutex_lock(&balloon_mutex);
> +
>   	} while (credit && state == BP_DONE);
>
> +	active = false;
> +
>   	/* Schedule more work if there is some still to be done. */
>   	if (state == BP_EAGAIN)
>   		schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);
>


  reply	other threads:[~2015-07-20 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 11:46 [Patch V2] xen: release lock occasionally during ballooning Juergen Gross
2015-07-20 11:48 ` Juergen Gross [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-07-20 11:49 Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ACE006.4000507@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).