All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Wanpeng Li <liwp.linux@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	PeterZijlstra <a.p.zijlstra@chello.nl>,
	Johannes Weiner <jweiner@redhat.com>,
	linux-mm@kvack.org, Gavin Shan <shangw@linux.vnet.ibm.com>,
	Wanpeng Li <liwp@linux.vnet.ibm.com>
Subject: Re: [PATCH] page-writeback.c: fix update bandwidth time judgment error
Date: Sun, 10 Jun 2012 15:24:14 +0800	[thread overview]
Message-ID: <20120610072414.GA11283@localhost> (raw)
In-Reply-To: <20120610045300.GA29336@kernel>

On Sun, Jun 10, 2012 at 12:54:03PM +0800, Wanpeng Li wrote:
> On Sun, Jun 10, 2012 at 12:36:41PM +0800, Fengguang Wu wrote:
> >Wanpeng,
> >
> >Sorry this I won't take this: it don't really improve anything.  Even
> >with the changed test, the real intervals are still some random values
> >above (and not far away from) 200ms.. We are saying about 200ms
> >intervals just for convenience.
> >
> But some parts like:
> 
> __bdi_update_bandwidth which bdi_update_bandwidth will call:
> 
> if(elapsed < BANDWIDTH_INTERVAL)
> 	return;
> 
> or
> 
> global_update_bandwidth:
> 
> if(time_before(now, update_time + BANDWIDTH_INTERVAL))
> 	return;
> 
> You me just ignore this disunion ?

Not a problem for me. But if that consistency makes you feel happy,
you might revise the changelog and resend. But it's not that simple
for the below reason..

> >On Sun, Jun 10, 2012 at 12:20:05PM +0800, Wanpeng Li wrote:
> >> From: Wanpneg Li <liwp@linux.vnet.ibm.com>
> >> 
> >> Since bdi_update_bandwidth function  should estimate write bandwidth at 200ms intervals,

The above line represents a wrong assumption. It's normal for the
re-estimate intervals to be >= 200ms.

> >> so the time is bdi->bw_time_stamp + BANDWIDTH_INTERVAL == jiffies, but
> >> if use time_is_after_eq_jiffies intervals will be bdi->bw_time_stamp +
> >> BANDWIDTH_INTERVAL + 1.

Strictly speaking, to ensure that ">= 200ms" is true, we'll have to
skip the "jiffies == bw_time_stamp + BANDWIDTH_INTERVAL" case. For
example, when HZ=100, the bw_time_stamp may actually be recorded in
the very last ms of a 10ms range, and jiffies may be in the very first
ms of the current 10ms range. So if using ">=" comparisons, it may
actually let less than 200ms intervals go though.

We can only reliably ensure "> 200ms", but no way for ">= 200ms".

Thanks,
Fengguang

> >> Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
> >> ---
> >>  mm/page-writeback.c |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> >> index c833bf0..099e225 100644
> >> --- a/mm/page-writeback.c
> >> +++ b/mm/page-writeback.c
> >> @@ -1032,7 +1032,7 @@ static void bdi_update_bandwidth(struct backing_dev_info *bdi,
> >>  				 unsigned long bdi_dirty,
> >>  				 unsigned long start_time)
> >>  {
> >> -	if (time_is_after_eq_jiffies(bdi->bw_time_stamp + BANDWIDTH_INTERVAL))
> >> +	if (time_is_after_jiffies(bdi->bw_time_stamp + BANDWIDTH_INTERVAL))
> >>  		return;
> >>  	spin_lock(&bdi->wb.list_lock);
> >>  	__bdi_update_bandwidth(bdi, thresh, bg_thresh, dirty,
> >> -- 
> >> 1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Fengguang Wu <fengguang.wu@intel.com>
To: Wanpeng Li <liwp.linux@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	PeterZijlstra <a.p.zijlstra@chello.nl>,
	Johannes Weiner <jweiner@redhat.com>,
	linux-mm@kvack.org, Gavin Shan <shangw@linux.vnet.ibm.com>,
	Wanpeng Li <liwp@linux.vnet.ibm.com>
Subject: Re: [PATCH] page-writeback.c: fix update bandwidth time judgment error
Date: Sun, 10 Jun 2012 15:24:14 +0800	[thread overview]
Message-ID: <20120610072414.GA11283@localhost> (raw)
In-Reply-To: <20120610045300.GA29336@kernel>

On Sun, Jun 10, 2012 at 12:54:03PM +0800, Wanpeng Li wrote:
> On Sun, Jun 10, 2012 at 12:36:41PM +0800, Fengguang Wu wrote:
> >Wanpeng,
> >
> >Sorry this I won't take this: it don't really improve anything.  Even
> >with the changed test, the real intervals are still some random values
> >above (and not far away from) 200ms.. We are saying about 200ms
> >intervals just for convenience.
> >
> But some parts like:
> 
> __bdi_update_bandwidth which bdi_update_bandwidth will call:
> 
> if(elapsed < BANDWIDTH_INTERVAL)
> 	return;
> 
> or
> 
> global_update_bandwidth:
> 
> if(time_before(now, update_time + BANDWIDTH_INTERVAL))
> 	return;
> 
> You me just ignore this disunion ?

Not a problem for me. But if that consistency makes you feel happy,
you might revise the changelog and resend. But it's not that simple
for the below reason..

> >On Sun, Jun 10, 2012 at 12:20:05PM +0800, Wanpeng Li wrote:
> >> From: Wanpneg Li <liwp@linux.vnet.ibm.com>
> >> 
> >> Since bdi_update_bandwidth function  should estimate write bandwidth at 200ms intervals,

The above line represents a wrong assumption. It's normal for the
re-estimate intervals to be >= 200ms.

> >> so the time is bdi->bw_time_stamp + BANDWIDTH_INTERVAL == jiffies, but
> >> if use time_is_after_eq_jiffies intervals will be bdi->bw_time_stamp +
> >> BANDWIDTH_INTERVAL + 1.

Strictly speaking, to ensure that ">= 200ms" is true, we'll have to
skip the "jiffies == bw_time_stamp + BANDWIDTH_INTERVAL" case. For
example, when HZ=100, the bw_time_stamp may actually be recorded in
the very last ms of a 10ms range, and jiffies may be in the very first
ms of the current 10ms range. So if using ">=" comparisons, it may
actually let less than 200ms intervals go though.

We can only reliably ensure "> 200ms", but no way for ">= 200ms".

Thanks,
Fengguang

> >> Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
> >> ---
> >>  mm/page-writeback.c |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> >> index c833bf0..099e225 100644
> >> --- a/mm/page-writeback.c
> >> +++ b/mm/page-writeback.c
> >> @@ -1032,7 +1032,7 @@ static void bdi_update_bandwidth(struct backing_dev_info *bdi,
> >>  				 unsigned long bdi_dirty,
> >>  				 unsigned long start_time)
> >>  {
> >> -	if (time_is_after_eq_jiffies(bdi->bw_time_stamp + BANDWIDTH_INTERVAL))
> >> +	if (time_is_after_jiffies(bdi->bw_time_stamp + BANDWIDTH_INTERVAL))
> >>  		return;
> >>  	spin_lock(&bdi->wb.list_lock);
> >>  	__bdi_update_bandwidth(bdi, thresh, bg_thresh, dirty,
> >> -- 
> >> 1.7.9.5

  reply	other threads:[~2012-06-10  7:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-10  4:20 [PATCH] page-writeback.c: fix update bandwidth time judgment error Wanpeng Li
2012-06-10  4:20 ` Wanpeng Li
2012-06-10  4:36 ` Fengguang Wu
2012-06-10  4:36   ` Fengguang Wu
2012-06-10  4:54   ` Wanpeng Li
2012-06-10  4:54     ` Wanpeng Li
2012-06-10  7:24     ` Fengguang Wu [this message]
2012-06-10  7:24       ` Fengguang Wu
2012-06-10  7:41       ` Wanpeng Li
2012-06-10  7:41         ` Wanpeng Li
2012-06-10  7:47         ` Fengguang Wu
2012-06-10  7:47           ` Fengguang Wu

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=20120610072414.GA11283@localhost \
    --to=fengguang.wu@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=jweiner@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwp.linux@gmail.com \
    --cc=liwp@linux.vnet.ibm.com \
    --cc=shangw@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.