public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Fernando Silveira <fsilveira@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: I/O and pdflush
Date: Sat, 29 Aug 2009 18:21:26 +0800	[thread overview]
Message-ID: <20090829102126.GA22409@localhost> (raw)
In-Reply-To: <20090829101247.GA20786@localhost>

On Sat, Aug 29, 2009 at 06:12:47PM +0800, Wu Fengguang wrote:
> On Sat, Aug 29, 2009 at 05:48:40AM +0800, Fernando Silveira wrote:
> > On Sun, Jul 12, 2009 at 05:04, Wu Fengguang<fengguang.wu@intel.com> wrote:
> > > On Sat, Jul 11, 2009 at 02:27:25PM -0300, Fernando Silveira wrote:
> > >> I'm having a hard time with an application that writes sequentially
> > >> 250GB of non-stop data directly to a solid state disk (OCZ SSD CORE
> > >> v2) device and I hope you can help me. The command "dd if=/dev/zero
> > >> of=/dev/sdc bs=4M" reproduces the same symptoms I'm having and writes
> > >> exactly as that application does.
> > >
> > > What's your kernel version?  Can the following patch help?
> > 
> > Sorry for the delay, but I could not test it before.
> > 
> > Unfortunately it did not help or change any symptoms at all. The
> > kernel version I tested was a non-patched 2.6.30.1 version.
> > 
> > Do you have any other hint?
> 
> Sure. Attached is a writeback debug patch. It will generate lots of
> kernel messages. You can just stop your klogd, start your workload
> and monitor the SSD writeback throughput via tools like iostat/dstat.

Fernando, will you post the output of iostat/dstat too? Thanks!
The ssd-no_dirty_buffer_with_random_192mb_writes.png is a good overview,
however I'd like to also check out the numbers for each second :)

Thanks,
Fengguang

> When it goes into the suboptimal 25MB/s state for several seconds, run
>         dmesg > dmesg-writeback
> and send me the log.
> 
> And it is advised to turn on the kconfig option CONFIG_PRINTK_TIME=y.
> 
> Thanks,
> Fengguang

>  mm/page-writeback.c |   38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> --- mm.orig/mm/page-writeback.c
> +++ mm/mm/page-writeback.c
> @@ -116,6 +116,33 @@ EXPORT_SYMBOL(laptop_mode);
>  
>  /* End of sysctl-exported parameters */
>  
> +#define writeback_debug_report(n, wbc) do {                               \
> +	__writeback_debug_report(n, wbc, __FILE__, __LINE__, __FUNCTION__); \
> +} while (0)
> +
> +void print_writeback_control(struct writeback_control *wbc)
> +{
> +	printk(KERN_DEBUG
> +			"global dirty %lu writeback %lu nfs %lu "
> +			"flags %c%c towrite %ld skipped %ld\n",
> +			global_page_state(NR_FILE_DIRTY),
> +			global_page_state(NR_WRITEBACK),
> +			global_page_state(NR_UNSTABLE_NFS),
> +			wbc->encountered_congestion ? 'C':'_',
> +			wbc->more_io ? 'M':'_',
> +			wbc->nr_to_write,
> +			wbc->pages_skipped);
> +}
> +
> +void __writeback_debug_report(long n, struct writeback_control *wbc,
> +		const char *file, int line, const char *func)
> +{
> +	printk(KERN_DEBUG "%s %d %s: %s(%d) %ld\n",
> +			file, line, func,
> +			current->comm, current->pid,
> +			n);
> +	print_writeback_control(wbc);
> +}
>  
>  static void background_writeout(unsigned long _min_pages);
>  
> @@ -546,6 +573,7 @@ static void balance_dirty_pages(struct a
>  			pages_written += write_chunk - wbc.nr_to_write;
>  			get_dirty_limits(&background_thresh, &dirty_thresh,
>  				       &bdi_thresh, bdi);
> +			writeback_debug_report(pages_written, &wbc);
>  		}
>  
>  		/*
> @@ -572,6 +600,7 @@ static void balance_dirty_pages(struct a
>  			break;		/* We've done our duty */
>  
>  		congestion_wait(WRITE, HZ/10);
> +		writeback_debug_report(-pages_written, &wbc);
>  	}
>  
>  	if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
> @@ -666,6 +695,11 @@ void throttle_vm_writeout(gfp_t gfp_mask
>  			global_page_state(NR_WRITEBACK) <= dirty_thresh)
>                          	break;
>                  congestion_wait(WRITE, HZ/10);
> +		printk(KERN_DEBUG "throttle_vm_writeout: "
> +				"congestion_wait on %lu+%lu > %lu\n",
> +				global_page_state(NR_UNSTABLE_NFS),
> +				global_page_state(NR_WRITEBACK),
> +				dirty_thresh);
>  
>  		/*
>  		 * The caller might hold locks which can prevent IO completion
> @@ -715,7 +749,9 @@ static void background_writeout(unsigned
>  			else
>  				break;
>  		}
> +		writeback_debug_report(min_pages, &wbc);
>  	}
> +	writeback_debug_report(min_pages, &wbc);
>  }
>  
>  /*
> @@ -788,7 +824,9 @@ static void wb_kupdate(unsigned long arg
>  				break;	/* All the old data is written */
>  		}
>  		nr_to_write -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
> +		writeback_debug_report(nr_to_write, &wbc);
>  	}
> +	writeback_debug_report(nr_to_write, &wbc);
>  	if (time_before(next_jif, jiffies + HZ))
>  		next_jif = jiffies + HZ;
>  	if (dirty_writeback_interval)


  reply	other threads:[~2009-08-29 10:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 17:27 I/O and pdflush Fernando Silveira
2009-07-12  8:04 ` Wu Fengguang
2009-08-28 21:48   ` Fernando Silveira
2009-08-29 10:12     ` Wu Fengguang
2009-08-29 10:21       ` Wu Fengguang [this message]
2009-08-31 13:24         ` Fernando Silveira
2009-08-31 14:00           ` Wu Fengguang
2009-08-31 14:01             ` Wu Fengguang
2009-08-31 14:07               ` Wu Fengguang
2009-08-31 14:33                 ` Fernando Silveira
2009-09-01  8:14                   ` Wu Fengguang
     [not found]                     ` <6afc6d4a0909010710l2cf77fbbmb1ab192ed12a7efc@mail.gmail.com>
2009-09-02  3:05                       ` Wu Fengguang
     [not found]                         ` <6afc6d4a0909020429l2bfecee9xd00527fcaa323751@mail.gmail.com>
     [not found]                           ` <20090902125057.GA7982@localhost>
     [not found]                             ` <6afc6d4a0909031346qda0b17coe4c60250fcac827f@mail.gmail.com>
2009-09-04  2:21                               ` Wu Fengguang
2009-09-04  2:34                                 ` Wu Fengguang
     [not found] <cWOyL-3Ys-15@gated-at.bofh.it>
2009-08-31 21:57 ` Daniel J Blueman
2009-09-01 14:33   ` Fernando Silveira

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=20090829102126.GA22409@localhost \
    --to=fengguang.wu@intel.com \
    --cc=fsilveira@gmail.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