From: Wu Fengguang <fengguang.wu@intel.com>
To: "sedat.dilek@gmail.com" <sedat.dilek@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,
Trond Myklebust <Trond.Myklebust@netapp.com>,
Dave Chinner <david@fromorbit.com>,
"Theodore Ts'o" <tytso@mit.edu>,
Chris Mason <chris.mason@oracle.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mel Gorman <mel@csn.ul.ie>, Rik van Riel <riel@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Greg Thelen <gthelen@google.com>,
Minchan Kim <minchan.kim@gmail.com>,
Vivek Goyal <vgoyal@redhat.com>,
Andrea Righi <arighi@develer.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
linux-mm <linux-mm@kvack.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 00/12] IO-less dirty throttling v7
Date: Mon, 18 Apr 2011 16:18:08 +0800 [thread overview]
Message-ID: <20110418081808.GA10374@localhost> (raw)
In-Reply-To: <BANLkTinQoTgQR_hPGo6vEHbS-rGypkAmZw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 9511 bytes --]
> Unfortunately, this "v2" patch still breaks with gcc-4.6 here:
>
> LD .tmp_vmlinux1
> mm/built-in.o: In function `calc_period_shift.part.10':
> page-writeback.c:(.text+0x6458): undefined reference to `____ilog2_NaN'
> make[4]: *** [.tmp_vmlinux1] Error 1
>
> My patchset against next-20110415 looks like this:
>
> (+) OK writeback-dirty-throttling-v7/writeback-dirty-throttling-v7.patch
> (+) OK writeback-dirty-throttling-post-v7/0001-writeback-i386-compile-fix.patch
> (+) OK writeback-dirty-throttling-post-v7/0002-writeback-quick-CONFIG_BLK_DEV_THROTTLING-n-compile-.patch
> (+) OK writeback-dirty-throttling-post-v7/0003-Revert-writeback-scale-dirty-proportions-period-with.patch
> (+) OK writeback-dirty-throttling-v7-fix/writeback-scale-dirty-proportions-period-with-writeout-bandwidth-v2.patch
>
> Attached are the disasm of mm/page-writeback.o (v2, gcc-4.6) and the
> disasm of yesterday's experiments with gcc-4.5.
>
> [ gcc-4.5 ]
>
> 00006574 <calc_period_shift>:
> 6574: a1 90 00 00 00 mov 0x90,%eax 6575:
> R_386_32 default_backing_dev_info
> 6579: 55 push %ebp
> 657a: 89 e5 mov %esp,%ebp
> 657c: e8 02 f8 ff ff call 5d83 <__ilog2_u32>
> 6581: 5d pop %ebp
> 6582: 83 c0 02 add $0x2,%eax
> 6585: c3 ret
gcc-4.5 is generating the right code, while the below silly macro
expansion seems like __builtin_constant_p(n) wrongly evaluating to true.
I wonder if the attached patch will workaround the gcc's bug. It adds a
local variable in calc_period_shift() for passing to ilog2().
Thanks,
Fengguang
> [ gcc-4.6 ]
>
> 000008c9 <calc_period_shift.part.10>:
> 8c9: 8b 15 90 00 00 00 mov 0x90,%edx 8cb:
> R_386_32 default_backing_dev_info
> 8cf: 55 push %ebp
> 8d0: 89 e5 mov %esp,%ebp
> 8d2: 85 d2 test %edx,%edx
> 8d4: 0f 88 46 01 00 00 js a20
> <calc_period_shift.part.10+0x157>
> 8da: f7 c2 00 00 00 40 test $0x40000000,%edx
> 8e0: b8 20 00 00 00 mov $0x20,%eax
> 8e5: 0f 85 3a 01 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 8eb: f7 c2 00 00 00 20 test $0x20000000,%edx
> 8f1: b0 1f mov $0x1f,%al
> 8f3: 0f 85 2c 01 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 8f9: f7 c2 00 00 00 10 test $0x10000000,%edx
> 8ff: b0 1e mov $0x1e,%al
> 901: 0f 85 1e 01 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 907: f7 c2 00 00 00 08 test $0x8000000,%edx
> 90d: b0 1d mov $0x1d,%al
> 90f: 0f 85 10 01 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 915: f7 c2 00 00 00 04 test $0x4000000,%edx
> 91b: b0 1c mov $0x1c,%al
> 91d: 0f 85 02 01 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 923: f7 c2 00 00 00 02 test $0x2000000,%edx
> 929: b0 1b mov $0x1b,%al
> 92b: 0f 85 f4 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 931: f7 c2 00 00 00 01 test $0x1000000,%edx
> 937: b0 1a mov $0x1a,%al
> 939: 0f 85 e6 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 93f: f7 c2 00 00 80 00 test $0x800000,%edx
> 945: b0 19 mov $0x19,%al
> 947: 0f 85 d8 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 94d: f7 c2 00 00 40 00 test $0x400000,%edx
> 953: b0 18 mov $0x18,%al
> 955: 0f 85 ca 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 95b: f7 c2 00 00 20 00 test $0x200000,%edx
> 961: b0 17 mov $0x17,%al
> 963: 0f 85 bc 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 969: f7 c2 00 00 10 00 test $0x100000,%edx
> 96f: b0 16 mov $0x16,%al
> 971: 0f 85 ae 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 977: f7 c2 00 00 08 00 test $0x80000,%edx
> 97d: b0 15 mov $0x15,%al
> 97f: 0f 85 a0 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 985: f7 c2 00 00 04 00 test $0x40000,%edx
> 98b: b0 14 mov $0x14,%al
> 98d: 0f 85 92 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 993: f7 c2 00 00 02 00 test $0x20000,%edx
> 999: b0 13 mov $0x13,%al
> 99b: 0f 85 84 00 00 00 jne a25
> <calc_period_shift.part.10+0x15c>
> 9a1: f7 c2 00 00 01 00 test $0x10000,%edx
> 9a7: b0 12 mov $0x12,%al
> 9a9: 75 7a jne a25
> <calc_period_shift.part.10+0x15c>
> 9ab: f6 c6 80 test $0x80,%dh
> 9ae: b0 11 mov $0x11,%al
> 9b0: 75 73 jne a25
> <calc_period_shift.part.10+0x15c>
> 9b2: f6 c6 40 test $0x40,%dh
> 9b5: b0 10 mov $0x10,%al
> 9b7: 75 6c jne a25
> <calc_period_shift.part.10+0x15c>
> 9b9: f6 c6 20 test $0x20,%dh
> 9bc: b0 0f mov $0xf,%al
> 9be: 75 65 jne a25
> <calc_period_shift.part.10+0x15c>
> 9c0: f6 c6 10 test $0x10,%dh
> 9c3: b0 0e mov $0xe,%al
> 9c5: 75 5e jne a25
> <calc_period_shift.part.10+0x15c>
> 9c7: f6 c6 08 test $0x8,%dh
> 9ca: b0 0d mov $0xd,%al
> 9cc: 75 57 jne a25
> <calc_period_shift.part.10+0x15c>
> 9ce: f6 c6 04 test $0x4,%dh
> 9d1: b0 0c mov $0xc,%al
> 9d3: 75 50 jne a25
> <calc_period_shift.part.10+0x15c>
> 9d5: f6 c6 02 test $0x2,%dh
> 9d8: b0 0b mov $0xb,%al
> 9da: 75 49 jne a25
> <calc_period_shift.part.10+0x15c>
> 9dc: f6 c6 01 test $0x1,%dh
> 9df: b0 0a mov $0xa,%al
> 9e1: 75 42 jne a25
> <calc_period_shift.part.10+0x15c>
> 9e3: f6 c2 80 test $0x80,%dl
> 9e6: b0 09 mov $0x9,%al
> 9e8: 75 3b jne a25
> <calc_period_shift.part.10+0x15c>
> 9ea: f6 c2 40 test $0x40,%dl
> 9ed: b0 08 mov $0x8,%al
> 9ef: 75 34 jne a25
> <calc_period_shift.part.10+0x15c>
> 9f1: f6 c2 20 test $0x20,%dl
> 9f4: b0 07 mov $0x7,%al
> 9f6: 75 2d jne a25
> <calc_period_shift.part.10+0x15c>
> 9f8: f6 c2 10 test $0x10,%dl
> 9fb: b0 06 mov $0x6,%al
> 9fd: 75 26 jne a25
> <calc_period_shift.part.10+0x15c>
> 9ff: f6 c2 08 test $0x8,%dl
> a02: b0 05 mov $0x5,%al
> a04: 75 1f jne a25
> <calc_period_shift.part.10+0x15c>
> a06: f6 c2 04 test $0x4,%dl
> a09: b0 04 mov $0x4,%al
> a0b: 75 18 jne a25
> <calc_period_shift.part.10+0x15c>
> a0d: f6 c2 02 test $0x2,%dl
> a10: b0 03 mov $0x3,%al
> a12: 75 11 jne a25
> <calc_period_shift.part.10+0x15c>
> a14: 80 e2 01 and $0x1,%dl
> a17: b0 02 mov $0x2,%al
> a19: 75 0a jne a25
> <calc_period_shift.part.10+0x15c>
> a1b: e8 fc ff ff ff call a1c
> <calc_period_shift.part.10+0x153> a1c: R_386_PC32 ____ilog2_NaN
> a20: b8 21 00 00 00 mov $0x21,%eax
> a25: 5d pop %ebp
> a26: c3 ret
>
> 00000a27 <calc_period_shift>:
> a27: 55 push %ebp
> a28: 83 ca ff or $0xffffffff,%edx
> a2b: 89 e5 mov %esp,%ebp
> a2d: 0f bd 05 90 00 00 00 bsr 0x90,%eax a30:
> R_386_32 default_backing_dev_info
> a34: 0f 44 c2 cmove %edx,%eax
> a37: 5d pop %ebp
> a38: 83 c0 02 add $0x2,%eax
> a3b: c3 ret
>
> - EOT -
>
> - Sedat -
[-- Attachment #2: writeback-adaptive-proportions-shift.patch --]
[-- Type: text/x-diff, Size: 2280 bytes --]
Subject: writeback: scale dirty proportions period with writeout bandwidth
Date: Sat Apr 16 18:38:41 CST 2011
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
mm/page-writeback.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
--- linux-next.orig/mm/page-writeback.c 2011-04-17 20:52:13.000000000 +0800
+++ linux-next/mm/page-writeback.c 2011-04-18 16:06:03.000000000 +0800
@@ -121,20 +121,15 @@ static struct prop_descriptor vm_complet
static struct prop_descriptor vm_dirties;
/*
- * couple the period to the dirty_ratio:
+ * couple the period to global write throughput:
*
- * period/2 ~ roundup_pow_of_two(dirty limit)
+ * period/2 ~ roundup_pow_of_two(write IO throughput)
*/
static int calc_period_shift(void)
{
- unsigned long dirty_total;
+ unsigned long bw = default_backing_dev_info.avg_write_bandwidth;
- if (vm_dirty_bytes)
- dirty_total = vm_dirty_bytes / PAGE_SIZE;
- else
- dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) /
- 100;
- return 2 + ilog2(dirty_total - 1);
+ return 2 + ilog2(bw);
}
/*
@@ -143,6 +138,14 @@ static int calc_period_shift(void)
static void update_completion_period(void)
{
int shift = calc_period_shift();
+
+ if (shift > PROP_MAX_SHIFT)
+ shift = PROP_MAX_SHIFT;
+
+ if (shift <= vm_completions.pg[0].shift &&
+ shift > vm_completions.pg[0].shift / 4)
+ return;
+
prop_change_shift(&vm_completions, shift);
prop_change_shift(&vm_dirties, shift);
}
@@ -180,7 +183,6 @@ int dirty_ratio_handler(struct ctl_table
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
if (ret == 0 && write && vm_dirty_ratio != old_ratio) {
- update_completion_period();
vm_dirty_bytes = 0;
}
return ret;
@@ -196,7 +198,6 @@ int dirty_bytes_handler(struct ctl_table
ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
if (ret == 0 && write && vm_dirty_bytes != old_bytes) {
- update_completion_period();
vm_dirty_ratio = 0;
}
return ret;
@@ -1044,6 +1045,8 @@ snapshot:
bdi->bw_time_stamp = now;
unlock:
spin_unlock(&dirty_lock);
+ if (gbdi->bw_time_stamp == now)
+ update_completion_period();
}
static unsigned long max_pause(struct backing_dev_info *bdi,
next prev parent reply other threads:[~2011-04-18 8:18 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-16 13:25 [PATCH 00/12] IO-less dirty throttling v7 Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 01/12] writeback: account per-bdi accumulated written pages Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 02/12] writeback: account per-bdi accumulated dirtied pages Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 03/12] writeback: bdi write bandwidth estimation Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 04/12] writeback: smoothed global/bdi dirty pages Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 05/12] writeback: smoothed dirty threshold and limit Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 06/12] writeback: enforce 1/4 gap between the dirty/background thresholds Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 07/12] writeback: base throttle bandwidth and position ratio Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 08/12] writeback: IO-less balance_dirty_pages() Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 09/12] writeback: show bdi write bandwidth in debugfs Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 10/12] writeback: trace dirty_ratelimit Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 11/12] writeback: trace balance_dirty_pages Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 13:25 ` [PATCH 12/12] writeback: trace global_dirty_state Wu Fengguang
2011-04-16 13:25 ` Wu Fengguang
2011-04-16 16:27 ` [PATCH 00/12] IO-less dirty throttling v7 Sedat Dilek
2011-04-17 1:44 ` Wu Fengguang
2011-04-17 3:18 ` Sedat Dilek
2011-04-17 4:10 ` Wu Fengguang
2011-04-17 4:10 ` Wu Fengguang
2011-04-17 4:10 ` Wu Fengguang
2011-04-17 4:46 ` Sedat Dilek
2011-04-17 4:46 ` Sedat Dilek
2011-04-17 6:46 ` Sedat Dilek
2011-04-18 0:13 ` Wu Fengguang
2011-04-18 0:13 ` Wu Fengguang
2011-04-18 6:57 ` Sedat Dilek
2011-04-18 8:18 ` Wu Fengguang [this message]
2011-04-18 10:22 ` Sedat Dilek
2011-04-17 7:31 ` Marco Stornelli
2011-04-17 7:31 ` Marco Stornelli
2011-04-17 9:30 ` Wu Fengguang
2011-04-17 9:30 ` Wu Fengguang
2011-04-17 17:44 ` Marco Stornelli
2011-04-17 17:44 ` Marco Stornelli
2011-04-17 23:31 ` Wu Fengguang
2011-04-17 23:31 ` Wu Fengguang
2011-04-26 17:19 ` Vivek Goyal
2011-04-26 17:19 ` Vivek Goyal
2011-04-28 14:27 ` Wu Fengguang
2011-04-28 14:27 ` Wu Fengguang
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=20110418081808.GA10374@localhost \
--to=fengguang.wu@intel.com \
--cc=Trond.Myklebust@netapp.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=arighi@develer.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=chris.mason@oracle.com \
--cc=david@fromorbit.com \
--cc=gthelen@google.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.com \
--cc=sedat.dilek@gmail.com \
--cc=tytso@mit.edu \
--cc=vgoyal@redhat.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.