public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Jens Axboe <jens.axboe@oracle.com>, Jim Paris <jim@jtan.com>,
	Cell Broadband Engine OSS Development  <cbe-oss-dev@ozlabs.org>,
	Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block/ps3: Fix slow VRAM IO
Date: Tue, 3 Nov 2009 00:23:22 -0800	[thread overview]
Message-ID: <20091103002322.1f04adbe.akpm@linux-foundation.org> (raw)
In-Reply-To: <4ADCC4E3.8060104@am.sony.com>

On Mon, 19 Oct 2009 12:58:27 -0700 Geoff Levand <geoffrey.levand@am.sony.com> wrote:

> 
> From: Hideyuki Sasaki <Hideyuki_Sasaki@hq.scei.sony.co.jp>
> 
> The current PS3 VRAM driver uses msleep() to wait for completion
> of RSX DMA transfers between system memory and VRAM.  Depending
> on the system timing, the processing delay and overhead of this
> msleep() call can significantly impact VRAM driver IO.
> 
> To avoid the condition, add a short duration (200 usec max)
> udelay() polling loop before entering the msleep() polling
> loop.
> 

When raising a performance-based patch, please always try to include
before-and-after performance measurements in the changelog.  People
want to know the magnitude of the improvement.

> 
>  drivers/block/ps3vram.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> --- a/drivers/block/ps3vram.c
> +++ b/drivers/block/ps3vram.c
> @@ -123,7 +123,15 @@ static int ps3vram_notifier_wait(struct 
>  {
>  	struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
>  	u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
> -	unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
> +	unsigned long timeout;
> +
> +	for (timeout = 20; timeout; timeout--) {

	for (timeout = 0; timeout < 20; timeout++) {

would be simpler.

> +		if (!notify[3])
> +			return 0;
> +		udelay(10);
> +	}

You might as well do a udelay(1) here.  The additional cost will be
negligible, and it will reduce latency.

> +	timeout = jiffies + msecs_to_jiffies(timeout_ms);

The maximum latency is now timout_ms + 200usec.

That's OK with the current constants, but if someone later changes a
constant, the error could become significant.

Perhaps that isn't worth bothering about though.

>  	do {
>  		if (!notify[3])



  parent reply	other threads:[~2009-11-03  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 19:58 [PATCH] block/ps3: Fix slow VRAM IO Geoff Levand
2009-10-19 20:03 ` Jim Paris
2009-11-03  8:23 ` Andrew Morton [this message]
2009-11-09  6:40   ` [Cbe-oss-dev] " Akira Tsukamoto
2009-11-13  2:03     ` Akira Tsukamoto
2009-11-13  7:20       ` Jens Axboe
2009-11-28 22:50     ` [Cbe-oss-dev] " Siarhei Siamashka

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=20091103002322.1f04adbe.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=geoffrey.levand@am.sony.com \
    --cc=jens.axboe@oracle.com \
    --cc=jim@jtan.com \
    --cc=linux-kernel@vger.kernel.org \
    /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