* [PATCH 00/12] per device dirty throttling -v4
@ 2007-04-17 7:10 Peter Zijlstra
2007-04-17 7:10 ` [PATCH 01/12] revert per-backing_dev-dirty-and-writeback-page-accounting Peter Zijlstra
` (11 more replies)
0 siblings, 12 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
The latest version of the per device dirty throttling.
Dropped all the congestion_wait() churn, will contemplate a rename patch.
Reworked the BDI statistics to use percpu_counter.
against 2.6.21-rc6-mm1; the first patch is for easy application.
Andrew can of course just drop the patch it reverts.
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/12] revert per-backing_dev-dirty-and-writeback-page-accounting
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 02/12] nfs: remove congestion_end() Peter Zijlstra
` (10 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: revert.patch --]
[-- Type: text/plain, Size: 6613 bytes --]
For ease of application..
---
block/ll_rw_blk.c | 29 -----------------------------
fs/buffer.c | 1 -
include/linux/backing-dev.h | 2 --
mm/page-writeback.c | 13 ++-----------
mm/truncate.c | 1 -
5 files changed, 2 insertions(+), 44 deletions(-)
Index: linux-2.6/block/ll_rw_blk.c
===================================================================
--- linux-2.6.orig/block/ll_rw_blk.c 2007-04-10 16:30:55.000000000 +0200
+++ linux-2.6/block/ll_rw_blk.c 2007-04-10 16:35:24.000000000 +0200
@@ -201,8 +201,6 @@ EXPORT_SYMBOL(blk_queue_softirq_done);
**/
void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn)
{
- struct backing_dev_info *bdi = &q->backing_dev_info;
-
/*
* set defaults
*/
@@ -210,8 +208,6 @@ void blk_queue_make_request(request_queu
blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
q->make_request_fn = mfn;
- atomic_long_set(&bdi->nr_dirty, 0);
- atomic_long_set(&bdi->nr_writeback, 0);
blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
blk_queue_hardsect_size(q, 512);
blk_queue_dma_alignment(q, 511);
@@ -3978,19 +3974,6 @@ static ssize_t queue_max_hw_sectors_show
return queue_var_show(max_hw_sectors_kb, (page));
}
-static ssize_t queue_nr_dirty_show(struct request_queue *q, char *page)
-{
- return sprintf(page, "%lu\n",
- atomic_long_read(&q->backing_dev_info.nr_dirty));
-
-}
-
-static ssize_t queue_nr_writeback_show(struct request_queue *q, char *page)
-{
- return sprintf(page, "%lu\n",
- atomic_long_read(&q->backing_dev_info.nr_writeback));
-
-}
static struct queue_sysfs_entry queue_requests_entry = {
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
@@ -4021,16 +4004,6 @@ static struct queue_sysfs_entry queue_ma
.show = queue_max_hw_sectors_show,
};
-static struct queue_sysfs_entry queue_nr_dirty_entry = {
- .attr = {.name = "nr_dirty", .mode = S_IRUGO },
- .show = queue_nr_dirty_show,
-};
-
-static struct queue_sysfs_entry queue_nr_writeback_entry = {
- .attr = {.name = "nr_writeback", .mode = S_IRUGO },
- .show = queue_nr_writeback_show,
-};
-
static struct queue_sysfs_entry queue_iosched_entry = {
.attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
.show = elv_iosched_show,
@@ -4043,8 +4016,6 @@ static struct attribute *default_attrs[]
&queue_initial_ra_entry.attr,
&queue_max_hw_sectors_entry.attr,
&queue_max_sectors_entry.attr,
- &queue_nr_dirty_entry.attr,
- &queue_nr_writeback_entry.attr,
&queue_iosched_entry.attr,
NULL,
};
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c 2007-04-10 16:30:15.000000000 +0200
+++ linux-2.6/fs/buffer.c 2007-04-10 16:35:03.000000000 +0200
@@ -740,7 +740,6 @@ int __set_page_dirty_buffers(struct page
if (page->mapping) { /* Race with truncate? */
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
- atomic_long_inc(&mapping->backing_dev_info->nr_dirty);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-10 16:30:55.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-10 16:35:03.000000000 +0200
@@ -30,8 +30,6 @@ struct backing_dev_info {
unsigned long ra_thrash_bytes; /* estimated thrashing threshold */
unsigned long state; /* Always use atomic bitops on this */
unsigned int capabilities; /* Device capabilities */
- atomic_long_t nr_dirty; /* Pages dirty against this BDI */
- atomic_long_t nr_writeback;/* Pages under writeback against this BDI */
congested_fn *congested_fn; /* Function pointer if device is md/dm */
void *congested_data; /* Pointer to aux data for congested func */
void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-10 16:30:15.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-10 16:35:03.000000000 +0200
@@ -828,8 +828,6 @@ int __set_page_dirty_nobuffers(struct pa
BUG_ON(mapping2 != mapping);
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
- atomic_long_inc(&mapping->backing_dev_info->
- nr_dirty);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
@@ -963,7 +961,6 @@ int clear_page_dirty_for_io(struct page
*/
if (TestClearPageDirty(page)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
- atomic_long_dec(&mapping->backing_dev_info->nr_dirty);
return 1;
}
return 0;
@@ -982,13 +979,10 @@ int test_clear_page_writeback(struct pag
write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestClearPageWriteback(page);
- if (ret) {
+ if (ret)
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
- atomic_long_dec(&mapping->backing_dev_info->
- nr_writeback);
- }
write_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
ret = TestClearPageWriteback(page);
@@ -1008,13 +1002,10 @@ int test_set_page_writeback(struct page
write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestSetPageWriteback(page);
- if (!ret) {
+ if (!ret)
radix_tree_tag_set(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
- atomic_long_inc(&mapping->backing_dev_info->
- nr_writeback);
- }
if (!PageDirty(page))
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
Index: linux-2.6/mm/truncate.c
===================================================================
--- linux-2.6.orig/mm/truncate.c 2007-04-10 16:30:15.000000000 +0200
+++ linux-2.6/mm/truncate.c 2007-04-10 16:35:03.000000000 +0200
@@ -70,7 +70,6 @@ void cancel_dirty_page(struct page *page
if (TestClearPageDirty(page)) {
struct address_space *mapping = page->mapping;
if (mapping && mapping_cap_account_dirty(mapping)) {
- atomic_long_dec(&mapping->backing_dev_info->nr_dirty);
dec_zone_page_state(page, NR_FILE_DIRTY);
if (account_size)
task_io_account_cancelled_write(account_size);
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 02/12] nfs: remove congestion_end()
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
2007-04-17 7:10 ` [PATCH 01/12] revert per-backing_dev-dirty-and-writeback-page-accounting Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 03/12] lib: dampen the percpu_counter FBC_BATCH Peter Zijlstra
` (9 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: nfs_congestion_fixup.patch --]
[-- Type: text/plain, Size: 2440 bytes --]
Its redundant, clear_bdi_congested() already wakes the waiters.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
fs/nfs/write.c | 4 +---
include/linux/backing-dev.h | 1 -
mm/backing-dev.c | 13 -------------
3 files changed, 1 insertion(+), 17 deletions(-)
Index: linux-2.6-mm/fs/nfs/write.c
===================================================================
--- linux-2.6-mm.orig/fs/nfs/write.c 2007-04-05 16:24:50.000000000 +0200
+++ linux-2.6-mm/fs/nfs/write.c 2007-04-05 16:25:04.000000000 +0200
@@ -235,10 +235,8 @@ static void nfs_end_page_writeback(struc
struct nfs_server *nfss = NFS_SERVER(inode);
end_page_writeback(page);
- if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) {
+ if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
clear_bdi_congested(&nfss->backing_dev_info, WRITE);
- congestion_end(WRITE);
- }
}
/*
Index: linux-2.6-mm/include/linux/backing-dev.h
===================================================================
--- linux-2.6-mm.orig/include/linux/backing-dev.h 2007-04-05 16:24:50.000000000 +0200
+++ linux-2.6-mm/include/linux/backing-dev.h 2007-04-05 16:25:08.000000000 +0200
@@ -96,7 +96,6 @@ void clear_bdi_congested(struct backing_
void set_bdi_congested(struct backing_dev_info *bdi, int rw);
long congestion_wait(int rw, long timeout);
long congestion_wait_interruptible(int rw, long timeout);
-void congestion_end(int rw);
#define bdi_cap_writeback_dirty(bdi) \
(!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
Index: linux-2.6-mm/mm/backing-dev.c
===================================================================
--- linux-2.6-mm.orig/mm/backing-dev.c 2007-04-05 16:24:50.000000000 +0200
+++ linux-2.6-mm/mm/backing-dev.c 2007-04-05 16:25:16.000000000 +0200
@@ -70,16 +70,3 @@ long congestion_wait_interruptible(int r
return ret;
}
EXPORT_SYMBOL(congestion_wait_interruptible);
-
-/**
- * congestion_end - wake up sleepers on a congested backing_dev_info
- * @rw: READ or WRITE
- */
-void congestion_end(int rw)
-{
- wait_queue_head_t *wqh = &congestion_wqh[rw];
-
- if (waitqueue_active(wqh))
- wake_up(wqh);
-}
-EXPORT_SYMBOL(congestion_end);
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 03/12] lib: dampen the percpu_counter FBC_BATCH
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
2007-04-17 7:10 ` [PATCH 01/12] revert per-backing_dev-dirty-and-writeback-page-accounting Peter Zijlstra
2007-04-17 7:10 ` [PATCH 02/12] nfs: remove congestion_end() Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 04/12] lib: percpu_counter_mod64 Peter Zijlstra
` (8 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: percpu_counter_batch.patch --]
[-- Type: text/plain, Size: 1174 bytes --]
With the current logic the percpu_counter's accuracy delta is quadric
wrt the number of cpus in the system, reduce this to O(n ln n).
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/percpu_counter.h | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Index: linux-2.6-mm/include/linux/percpu_counter.h
===================================================================
--- linux-2.6-mm.orig/include/linux/percpu_counter.h
+++ linux-2.6-mm/include/linux/percpu_counter.h
@@ -11,6 +11,7 @@
#include <linux/threads.h>
#include <linux/percpu.h>
#include <linux/types.h>
+#include <linux/log2.h>
#ifdef CONFIG_SMP
@@ -20,11 +21,7 @@ struct percpu_counter {
s32 *counters;
};
-#if NR_CPUS >= 16
-#define FBC_BATCH (NR_CPUS*2)
-#else
-#define FBC_BATCH (NR_CPUS*4)
-#endif
+#define FBC_BATCH (8*ilog2(NR_CPUS))
static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
{
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 04/12] lib: percpu_counter_mod64
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (2 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 03/12] lib: dampen the percpu_counter FBC_BATCH Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 05/12] mm: bdi init hooks Peter Zijlstra
` (7 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: percpu_counter_mod.patch --]
[-- Type: text/plain, Size: 2522 bytes --]
Add percpu_counter_mod64() to allow large modifications.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/percpu_counter.h | 9 +++++++++
lib/percpu_counter.c | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
Index: linux-2.6/include/linux/percpu_counter.h
===================================================================
--- linux-2.6.orig/include/linux/percpu_counter.h 2007-04-12 13:54:55.000000000 +0200
+++ linux-2.6/include/linux/percpu_counter.h 2007-04-12 14:00:21.000000000 +0200
@@ -36,6 +36,7 @@ static inline void percpu_counter_destro
}
void percpu_counter_mod(struct percpu_counter *fbc, s32 amount);
+void percpu_counter_mod64(struct percpu_counter *fbc, s64 amount);
s64 percpu_counter_sum(struct percpu_counter *fbc);
static inline s64 percpu_counter_read(struct percpu_counter *fbc)
@@ -81,6 +82,14 @@ percpu_counter_mod(struct percpu_counter
preempt_enable();
}
+static inline void
+percpu_counter_mod64(struct percpu_counter *fbc, s64 amount)
+{
+ preempt_disable();
+ fbc->count += amount;
+ preempt_enable();
+}
+
static inline s64 percpu_counter_read(struct percpu_counter *fbc)
{
return fbc->count;
Index: linux-2.6/lib/percpu_counter.c
===================================================================
--- linux-2.6.orig/lib/percpu_counter.c 2006-07-31 13:07:38.000000000 +0200
+++ linux-2.6/lib/percpu_counter.c 2007-04-12 14:17:12.000000000 +0200
@@ -25,6 +25,34 @@ void percpu_counter_mod(struct percpu_co
}
EXPORT_SYMBOL(percpu_counter_mod);
+void percpu_counter_mod64(struct percpu_counter *fbc, s64 amount)
+{
+ long count;
+ s32 *pcount;
+ int cpu;
+
+ if (amount >= FBC_BATCH || amount <= -FBC_BATCH) {
+ spin_lock(&fbc->lock);
+ fbc->count += amount;
+ spin_unlock(&fbc->lock);
+ return;
+ }
+
+ cpu = get_cpu();
+ pcount = per_cpu_ptr(fbc->counters, cpu);
+ count = *pcount + amount;
+ if (count >= FBC_BATCH || count <= -FBC_BATCH) {
+ spin_lock(&fbc->lock);
+ fbc->count += count;
+ *pcount = 0;
+ spin_unlock(&fbc->lock);
+ } else {
+ *pcount = count;
+ }
+ put_cpu();
+}
+EXPORT_SYMBOL(percpu_counter_mod64);
+
/*
* Add up all the per-cpu counts, return the result. This is a more accurate
* but much slower version of percpu_counter_read_positive()
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 05/12] mm: bdi init hooks
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (3 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 04/12] lib: percpu_counter_mod64 Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 06/12] mm: scalable bdi statistics counters Peter Zijlstra
` (6 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_init.patch --]
[-- Type: text/plain, Size: 13655 bytes --]
provide BDI constructor/destructor hooks
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
block/ll_rw_blk.c | 2 ++
drivers/block/rd.c | 6 ++++++
drivers/char/mem.c | 2 ++
drivers/mtd/mtdcore.c | 5 +++++
fs/char_dev.c | 1 +
fs/configfs/configfs_internal.h | 2 ++
fs/configfs/inode.c | 8 ++++++++
fs/configfs/mount.c | 2 ++
fs/fuse/inode.c | 2 ++
fs/hugetlbfs/inode.c | 3 +++
fs/nfs/client.c | 3 +++
fs/ocfs2/dlm/dlmfs.c | 6 +++++-
fs/ramfs/inode.c | 7 ++++++-
fs/sysfs/inode.c | 5 +++++
fs/sysfs/mount.c | 2 ++
fs/sysfs/sysfs.h | 1 +
include/linux/backing-dev.h | 7 +++++++
kernel/cpuset.c | 3 +++
mm/shmem.c | 1 +
mm/swap.c | 2 ++
20 files changed, 68 insertions(+), 2 deletions(-)
Index: linux-2.6/block/ll_rw_blk.c
===================================================================
--- linux-2.6.orig/block/ll_rw_blk.c 2007-04-12 11:35:53.000000000 +0200
+++ linux-2.6/block/ll_rw_blk.c 2007-04-12 13:19:40.000000000 +0200
@@ -1771,6 +1771,7 @@ static void blk_release_queue(struct kob
blk_trace_shutdown(q);
+ bdi_destroy(&q->backing_dev_info);
kmem_cache_free(requestq_cachep, q);
}
@@ -1836,6 +1837,7 @@ request_queue_t *blk_alloc_queue_node(gf
q->kobj.ktype = &queue_ktype;
kobject_init(&q->kobj);
q->backing_dev_info = default_backing_dev_info;
+ bdi_init(&q->backing_dev_info);
q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
q->backing_dev_info.unplug_io_data = q;
Index: linux-2.6/drivers/block/rd.c
===================================================================
--- linux-2.6.orig/drivers/block/rd.c 2007-04-12 11:35:51.000000000 +0200
+++ linux-2.6/drivers/block/rd.c 2007-04-12 11:35:59.000000000 +0200
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void)
blk_cleanup_queue(rd_queue[i]);
}
unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
+
+ bdi_destroy(&rd_file_backing_dev_info);
+ bdi_destroy(&rd_backing_dev_info);
}
/*
@@ -421,6 +424,9 @@ static int __init rd_init(void)
int i;
int err = -ENOMEM;
+ bdi_init(&rd_backing_dev_info);
+ bdi_init(&rd_file_backing_dev_info);
+
if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 ||
(rd_blocksize & (rd_blocksize-1))) {
printk("RAMDISK: wrong blocksize %d, reverting to defaults\n",
Index: linux-2.6/drivers/char/mem.c
===================================================================
--- linux-2.6.orig/drivers/char/mem.c 2007-04-12 11:35:51.000000000 +0200
+++ linux-2.6/drivers/char/mem.c 2007-04-12 11:35:59.000000000 +0200
@@ -987,6 +987,8 @@ static int __init chr_dev_init(void)
MKDEV(MEM_MAJOR, devlist[i].minor),
devlist[i].name);
+ bdi_init(&zero_bdi);
+
return 0;
}
Index: linux-2.6/fs/char_dev.c
===================================================================
--- linux-2.6.orig/fs/char_dev.c 2007-04-12 11:35:51.000000000 +0200
+++ linux-2.6/fs/char_dev.c 2007-04-12 11:35:59.000000000 +0200
@@ -546,6 +546,7 @@ static struct kobject *base_probe(dev_t
void __init chrdev_init(void)
{
cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
+ bdi_init(&directly_mappable_cdev_bdi);
}
Index: linux-2.6/fs/fuse/inode.c
===================================================================
--- linux-2.6.orig/fs/fuse/inode.c 2007-04-12 11:35:51.000000000 +0200
+++ linux-2.6/fs/fuse/inode.c 2007-04-12 11:35:59.000000000 +0200
@@ -415,6 +415,7 @@ static struct fuse_conn *new_conn(void)
atomic_set(&fc->num_waiting, 0);
fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
fc->bdi.unplug_io_fn = default_unplug_io_fn;
+ bdi_init(&fc->bdi);
fc->reqctr = 0;
fc->blocked = 1;
get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
@@ -428,6 +429,7 @@ void fuse_conn_put(struct fuse_conn *fc)
if (fc->destroy_req)
fuse_request_free(fc->destroy_req);
mutex_destroy(&fc->inst_mutex);
+ bdi_destroy(&fc->bdi);
kfree(fc);
}
}
Index: linux-2.6/fs/nfs/client.c
===================================================================
--- linux-2.6.orig/fs/nfs/client.c 2007-04-12 11:35:51.000000000 +0200
+++ linux-2.6/fs/nfs/client.c 2007-04-12 11:35:59.000000000 +0200
@@ -657,6 +657,8 @@ static void nfs_server_set_fsinfo(struct
if (server->rsize > NFS_MAX_FILE_IO_SIZE)
server->rsize = NFS_MAX_FILE_IO_SIZE;
server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+
+ bdi_init(&server->backing_dev_info);
server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
server->backing_dev_info.ra_pages0 = min_t(unsigned, server->rpages,
VM_MIN_READAHEAD >> (PAGE_CACHE_SHIFT - 10));
@@ -789,6 +791,7 @@ void nfs_free_server(struct nfs_server *
nfs_put_client(server->nfs_client);
nfs_free_iostats(server->io_stats);
+ bdi_destroy(&server->backing_dev_info);
kfree(server);
nfs_release_automount_timer();
dprintk("<-- nfs_free_server()\n");
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-12 11:35:57.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-12 13:19:40.000000000 +0200
@@ -36,6 +36,13 @@ struct backing_dev_info {
void *unplug_io_data;
};
+static inline void bdi_init(struct backing_dev_info *bdi)
+{
+}
+
+static inline void bdi_destroy(struct backing_dev_info *bdi)
+{
+}
/*
* Flags in backing_dev_info::capability
Index: linux-2.6/drivers/mtd/mtdcore.c
===================================================================
--- linux-2.6.orig/drivers/mtd/mtdcore.c 2007-04-03 13:58:08.000000000 +0200
+++ linux-2.6/drivers/mtd/mtdcore.c 2007-04-12 11:37:45.000000000 +0200
@@ -60,6 +60,7 @@ int add_mtd_device(struct mtd_info *mtd)
break;
}
}
+ bdi_init(mtd->backing_dev_info);
BUG_ON(mtd->writesize == 0);
mutex_lock(&mtd_table_mutex);
@@ -142,6 +143,10 @@ int del_mtd_device (struct mtd_info *mtd
}
mutex_unlock(&mtd_table_mutex);
+
+ if (mtd->backing_dev_info)
+ bdi_destroy(mtd->backing_dev_info);
+
return ret;
}
Index: linux-2.6/fs/hugetlbfs/inode.c
===================================================================
--- linux-2.6.orig/fs/hugetlbfs/inode.c 2007-04-03 13:58:17.000000000 +0200
+++ linux-2.6/fs/hugetlbfs/inode.c 2007-04-12 12:11:15.000000000 +0200
@@ -819,6 +819,8 @@ static int __init init_hugetlbfs_fs(void
out:
if (error)
kmem_cache_destroy(hugetlbfs_inode_cachep);
+ else
+ bdi_init(&hugetlbfs_backing_dev_info);
return error;
}
@@ -826,6 +828,7 @@ static void __exit exit_hugetlbfs_fs(voi
{
kmem_cache_destroy(hugetlbfs_inode_cachep);
unregister_filesystem(&hugetlbfs_fs_type);
+ bdi_destroy(&hugetlbfs_backing_dev_info);
}
module_init(init_hugetlbfs_fs)
Index: linux-2.6/fs/ocfs2/dlm/dlmfs.c
===================================================================
--- linux-2.6.orig/fs/ocfs2/dlm/dlmfs.c 2007-04-03 13:58:17.000000000 +0200
+++ linux-2.6/fs/ocfs2/dlm/dlmfs.c 2007-04-12 12:08:18.000000000 +0200
@@ -614,8 +614,10 @@ bail:
kmem_cache_destroy(dlmfs_inode_cache);
if (cleanup_worker)
destroy_workqueue(user_dlm_worker);
- } else
+ } else {
+ bdi_init(&dlmfs_backing_dev_info);
printk("OCFS2 User DLM kernel interface loaded\n");
+ }
return status;
}
@@ -627,6 +629,8 @@ static void __exit exit_dlmfs_fs(void)
destroy_workqueue(user_dlm_worker);
kmem_cache_destroy(dlmfs_inode_cache);
+
+ bdi_destroy(&dlmfs_backing_dev_info);
}
MODULE_AUTHOR("Oracle");
Index: linux-2.6/fs/configfs/configfs_internal.h
===================================================================
--- linux-2.6.orig/fs/configfs/configfs_internal.h 2007-04-03 13:58:17.000000000 +0200
+++ linux-2.6/fs/configfs/configfs_internal.h 2007-04-12 11:51:13.000000000 +0200
@@ -55,6 +55,8 @@ extern int configfs_is_root(struct confi
extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *);
extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *));
+extern void configfs_inode_init(void);
+extern void configfs_inode_exit(void);
extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
extern int configfs_make_dirent(struct configfs_dirent *,
Index: linux-2.6/fs/configfs/inode.c
===================================================================
--- linux-2.6.orig/fs/configfs/inode.c 2007-04-03 13:58:17.000000000 +0200
+++ linux-2.6/fs/configfs/inode.c 2007-04-12 13:04:45.000000000 +0200
@@ -255,4 +255,12 @@ void configfs_hash_and_remove(struct den
mutex_unlock(&dir->d_inode->i_mutex);
}
+void __init configfs_inode_init(void)
+{
+ bdi_init(&configfs_backing_dev_info);
+}
+void __exit configfs_inode_exit(void)
+{
+ bdi_destroy(&configfs_backing_dev_info);
+}
Index: linux-2.6/fs/configfs/mount.c
===================================================================
--- linux-2.6.orig/fs/configfs/mount.c 2007-04-03 13:58:17.000000000 +0200
+++ linux-2.6/fs/configfs/mount.c 2007-04-12 12:07:34.000000000 +0200
@@ -156,6 +156,7 @@ static int __init configfs_init(void)
configfs_dir_cachep = NULL;
}
+ configfs_inode_init();
out:
return err;
}
@@ -166,6 +167,7 @@ static void __exit configfs_exit(void)
subsystem_unregister(&config_subsys);
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
+ configfs_inode_exit();
}
MODULE_AUTHOR("Oracle");
Index: linux-2.6/fs/ramfs/inode.c
===================================================================
--- linux-2.6.orig/fs/ramfs/inode.c 2007-04-12 11:53:41.000000000 +0200
+++ linux-2.6/fs/ramfs/inode.c 2007-04-12 12:06:22.000000000 +0200
@@ -210,12 +210,17 @@ static struct file_system_type rootfs_fs
static int __init init_ramfs_fs(void)
{
- return register_filesystem(&ramfs_fs_type);
+ int ret;
+ ret = register_filesystem(&ramfs_fs_type);
+ if (!ret)
+ bdi_init(&ramfs_backing_dev_info);
+ return ret;
}
static void __exit exit_ramfs_fs(void)
{
unregister_filesystem(&ramfs_fs_type);
+ bdi_destroy(&ramfs_backing_dev_info);
}
module_init(init_ramfs_fs)
Index: linux-2.6/fs/sysfs/inode.c
===================================================================
--- linux-2.6.orig/fs/sysfs/inode.c 2007-04-03 13:58:18.000000000 +0200
+++ linux-2.6/fs/sysfs/inode.c 2007-04-12 12:23:04.000000000 +0200
@@ -299,3 +299,8 @@ int sysfs_hash_and_remove(struct dentry
return found ? 0 : -ENOENT;
}
+
+void __init sysfs_inode_init(void)
+{
+ bdi_init(&sysfs_backing_dev_info);
+}
Index: linux-2.6/fs/sysfs/mount.c
===================================================================
--- linux-2.6.orig/fs/sysfs/mount.c 2007-04-03 13:58:18.000000000 +0200
+++ linux-2.6/fs/sysfs/mount.c 2007-04-12 12:23:08.000000000 +0200
@@ -108,6 +108,8 @@ int __init sysfs_init(void)
} else
goto out_err;
out:
+ if (!err)
+ sysfs_inode_init();
return err;
out_err:
kmem_cache_destroy(sysfs_dir_cachep);
Index: linux-2.6/fs/sysfs/sysfs.h
===================================================================
--- linux-2.6.orig/fs/sysfs/sysfs.h 2007-04-03 13:58:18.000000000 +0200
+++ linux-2.6/fs/sysfs/sysfs.h 2007-04-12 12:22:53.000000000 +0200
@@ -16,6 +16,7 @@ extern struct kmem_cache *sysfs_dir_cach
extern void sysfs_delete_inode(struct inode *inode);
extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *);
extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *));
+extern void sysfs_inode_init(void);
extern int sysfs_dirent_exist(struct sysfs_dirent *, const unsigned char *);
extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *,
Index: linux-2.6/kernel/cpuset.c
===================================================================
--- linux-2.6.orig/kernel/cpuset.c 2007-04-12 12:26:33.000000000 +0200
+++ linux-2.6/kernel/cpuset.c 2007-04-12 12:37:43.000000000 +0200
@@ -1921,6 +1921,7 @@ int __init cpuset_init_early(void)
tsk->cpuset = &top_cpuset;
tsk->cpuset->mems_generation = cpuset_mems_generation++;
+
return 0;
}
@@ -1963,6 +1964,8 @@ int __init cpuset_init(void)
/* memory_pressure_enabled is in root cpuset only */
if (err == 0)
err = cpuset_add_file(root, &cft_memory_pressure_enabled);
+ if (!err)
+ bdi_init(&cpuset_backing_dev_info);
out:
return err;
}
Index: linux-2.6/mm/shmem.c
===================================================================
--- linux-2.6.orig/mm/shmem.c 2007-04-12 12:28:01.000000000 +0200
+++ linux-2.6/mm/shmem.c 2007-04-12 12:28:14.000000000 +0200
@@ -2478,6 +2478,7 @@ static int __init init_tmpfs(void)
printk(KERN_ERR "Could not kern_mount tmpfs\n");
goto out1;
}
+ bdi_init(&shmem_backing_dev_info);
return 0;
out1:
Index: linux-2.6/mm/swap.c
===================================================================
--- linux-2.6.orig/mm/swap.c 2007-04-12 12:30:04.000000000 +0200
+++ linux-2.6/mm/swap.c 2007-04-12 12:37:18.000000000 +0200
@@ -550,6 +550,8 @@ void __init swap_setup(void)
{
unsigned long megs = num_physpages >> (20 - PAGE_SHIFT);
+ bdi_init(swapper_space.backing_dev_info);
+
/* Use a smaller cluster for small-memory machines */
if (megs < 16)
page_cluster = 2;
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 06/12] mm: scalable bdi statistics counters.
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (4 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 05/12] mm: bdi init hooks Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 07/12] mm: count dirty pages per BDI Peter Zijlstra
` (5 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat.patch --]
[-- Type: text/plain, Size: 3868 bytes --]
Provide scalable per backing_dev_info statistics counters.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/backing-dev.h | 50 ++++++++++++++++++++++++++++++++++++++++++--
mm/backing-dev.c | 26 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 2 deletions(-)
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-12 13:27:13.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-12 13:28:40.000000000 +0200
@@ -8,6 +8,7 @@
#ifndef _LINUX_BACKING_DEV_H
#define _LINUX_BACKING_DEV_H
+#include <linux/percpu_counter.h>
#include <asm/atomic.h>
struct page;
@@ -24,6 +25,10 @@ enum bdi_state {
typedef int (congested_fn)(void *, int);
+enum bdi_stat_item {
+ NR_BDI_STAT_ITEMS
+};
+
struct backing_dev_info {
unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
unsigned long ra_pages0; /* min readahead on start of file */
@@ -34,14 +39,55 @@ struct backing_dev_info {
void *congested_data; /* Pointer to aux data for congested func */
void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
void *unplug_io_data;
+
+ struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
};
-static inline void bdi_init(struct backing_dev_info *bdi)
+void bdi_init(struct backing_dev_info *bdi);
+void bdi_destroy(struct backing_dev_info *bdi);
+
+static inline void __mod_bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item, s32 amount)
+{
+ percpu_counter_mod(&bdi->bdi_stat[item], amount);
+}
+
+static inline void __inc_bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ __mod_bdi_stat(bdi, item, 1);
+}
+
+static inline void inc_bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ __inc_bdi_stat(bdi, item);
+ local_irq_restore(flags);
+}
+
+static inline void __dec_bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
{
+ __mod_bdi_stat(bdi, item, -1);
+}
+
+static inline void dec_bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ __dec_bdi_stat(bdi, item);
+ local_irq_restore(flags);
}
-static inline void bdi_destroy(struct backing_dev_info *bdi)
+static inline s64 bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
{
+ return percpu_counter_read_positive(&bdi->bdi_stat[item]);
}
/*
Index: linux-2.6/mm/backing-dev.c
===================================================================
--- linux-2.6.orig/mm/backing-dev.c 2007-04-12 13:27:10.000000000 +0200
+++ linux-2.6/mm/backing-dev.c 2007-04-12 13:28:26.000000000 +0200
@@ -5,6 +5,30 @@
#include <linux/sched.h>
#include <linux/module.h>
+void bdi_init(struct backing_dev_info *bdi)
+{
+ int i;
+
+ if (!(bdi_cap_writeback_dirty(bdi) || bdi_cap_account_dirty(bdi)))
+ return;
+
+ for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
+ percpu_counter_init(&bdi->bdi_stat[i], 0);
+}
+EXPORT_SYMBOL(bdi_init);
+
+void bdi_destroy(struct backing_dev_info *bdi)
+{
+ int i;
+
+ if (!(bdi_cap_writeback_dirty(bdi) || bdi_cap_account_dirty(bdi)))
+ return;
+
+ for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
+ percpu_counter_destroy(&bdi->bdi_stat[i]);
+}
+EXPORT_SYMBOL(bdi_destroy);
+
static wait_queue_head_t congestion_wqh[2] = {
__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
@@ -70,3 +94,5 @@ long congestion_wait_interruptible(int r
return ret;
}
EXPORT_SYMBOL(congestion_wait_interruptible);
+
+
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 07/12] mm: count dirty pages per BDI
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (5 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 06/12] mm: scalable bdi statistics counters Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 08/12] mm: count writeback " Peter Zijlstra
` (4 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat_dirty.patch --]
[-- Type: text/plain, Size: 2655 bytes --]
Count per BDI dirty pages.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
fs/buffer.c | 1 +
include/linux/backing-dev.h | 1 +
mm/page-writeback.c | 2 ++
mm/truncate.c | 1 +
4 files changed, 5 insertions(+)
Index: linux-2.6-mm/fs/buffer.c
===================================================================
--- linux-2.6-mm.orig/fs/buffer.c
+++ linux-2.6-mm/fs/buffer.c
@@ -740,6 +740,7 @@ int __set_page_dirty_buffers(struct page
if (page->mapping) { /* Race with truncate? */
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
+ __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
Index: linux-2.6-mm/mm/page-writeback.c
===================================================================
--- linux-2.6-mm.orig/mm/page-writeback.c
+++ linux-2.6-mm/mm/page-writeback.c
@@ -828,6 +828,7 @@ int __set_page_dirty_nobuffers(struct pa
BUG_ON(mapping2 != mapping);
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
+ __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
@@ -961,6 +962,7 @@ int clear_page_dirty_for_io(struct page
*/
if (TestClearPageDirty(page)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
+ dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
return 1;
}
return 0;
Index: linux-2.6-mm/mm/truncate.c
===================================================================
--- linux-2.6-mm.orig/mm/truncate.c
+++ linux-2.6-mm/mm/truncate.c
@@ -71,6 +71,7 @@ void cancel_dirty_page(struct page *page
struct address_space *mapping = page->mapping;
if (mapping && mapping_cap_account_dirty(mapping)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
+ dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
if (account_size)
task_io_account_cancelled_write(account_size);
}
Index: linux-2.6-mm/include/linux/backing-dev.h
===================================================================
--- linux-2.6-mm.orig/include/linux/backing-dev.h
+++ linux-2.6-mm/include/linux/backing-dev.h
@@ -26,6 +26,7 @@ enum bdi_state {
typedef int (congested_fn)(void *, int);
enum bdi_stat_item {
+ BDI_DIRTY,
NR_BDI_STAT_ITEMS
};
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 08/12] mm: count writeback pages per BDI
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (6 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 07/12] mm: count dirty pages per BDI Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 09/12] mm: count unstable " Peter Zijlstra
` (3 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat_writeback.patch --]
[-- Type: text/plain, Size: 2294 bytes --]
Count per BDI writeback pages.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/backing-dev.h | 1 +
mm/page-writeback.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-12 17:32:17.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-12 17:34:24.000000000 +0200
@@ -977,14 +977,18 @@ int test_clear_page_writeback(struct pag
int ret;
if (mapping) {
+ struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags;
write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestClearPageWriteback(page);
- if (ret)
+ if (ret) {
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
+ if (bdi_cap_writeback_dirty(bdi))
+ __dec_bdi_stat(bdi, BDI_WRITEBACK);
+ }
write_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
ret = TestClearPageWriteback(page);
@@ -1000,14 +1004,18 @@ int test_set_page_writeback(struct page
int ret;
if (mapping) {
+ struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags;
write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestSetPageWriteback(page);
- if (!ret)
+ if (!ret) {
radix_tree_tag_set(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
+ if (bdi_cap_writeback_dirty(bdi))
+ __inc_bdi_stat(bdi, BDI_WRITEBACK);
+ }
if (!PageDirty(page))
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-12 17:32:17.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-12 17:32:40.000000000 +0200
@@ -27,6 +27,7 @@ typedef int (congested_fn)(void *, int);
enum bdi_stat_item {
BDI_DIRTY,
+ BDI_WRITEBACK,
NR_BDI_STAT_ITEMS
};
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 09/12] mm: count unstable pages per BDI
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (7 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 08/12] mm: count writeback " Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-19 17:44 ` Miklos Szeredi
2007-04-17 7:10 ` [PATCH 10/12] mm: expose BDI statistics in sysfs Peter Zijlstra
` (2 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat_unstable.patch --]
[-- Type: text/plain, Size: 2287 bytes --]
Count per BDI unstable pages.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
fs/nfs/write.c | 4 ++++
include/linux/backing-dev.h | 1 +
2 files changed, 5 insertions(+)
Index: linux-2.6-mm/fs/nfs/write.c
===================================================================
--- linux-2.6-mm.orig/fs/nfs/write.c
+++ linux-2.6-mm/fs/nfs/write.c
@@ -449,6 +449,7 @@ nfs_mark_request_commit(struct nfs_page
nfsi->ncommit++;
spin_unlock(&nfsi->req_lock);
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+ inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
}
#endif
@@ -509,6 +510,7 @@ static void nfs_cancel_commit_list(struc
while(!list_empty(head)) {
req = nfs_list_entry(head->next);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
nfs_list_remove_request(req);
nfs_inode_remove_request(req);
nfs_unlock_request(req);
@@ -1234,6 +1236,7 @@ nfs_commit_list(struct inode *inode, str
nfs_list_remove_request(req);
nfs_mark_request_commit(req);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
nfs_clear_page_writeback(req);
}
return -ENOMEM;
@@ -1258,6 +1261,7 @@ static void nfs_commit_done(struct rpc_t
req = nfs_list_entry(data->pages.next);
nfs_list_remove_request(req);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
dprintk("NFS: commit (%s/%Ld %d@%Ld)",
req->wb_context->dentry->d_inode->i_sb->s_id,
Index: linux-2.6-mm/include/linux/backing-dev.h
===================================================================
--- linux-2.6-mm.orig/include/linux/backing-dev.h
+++ linux-2.6-mm/include/linux/backing-dev.h
@@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int);
enum bdi_stat_item {
BDI_DIRTY,
BDI_WRITEBACK,
+ BDI_UNSTABLE,
NR_BDI_STAT_ITEMS
};
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 10/12] mm: expose BDI statistics in sysfs.
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (8 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 09/12] mm: count unstable " Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 11/12] mm: per device dirty threshold Peter Zijlstra
2007-04-17 7:10 ` [PATCH 12/12] debug: expose BDI statistics in sysfs Peter Zijlstra
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat_sysfs.patch --]
[-- Type: text/plain, Size: 2351 bytes --]
Expose the per BDI stats in /sys/block/<dev>/queue/*
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
block/ll_rw_blk.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Index: linux-2.6-mm/block/ll_rw_blk.c
===================================================================
--- linux-2.6-mm.orig/block/ll_rw_blk.c
+++ linux-2.6-mm/block/ll_rw_blk.c
@@ -3976,6 +3976,20 @@ static ssize_t queue_max_hw_sectors_show
return queue_var_show(max_hw_sectors_kb, (page));
}
+static ssize_t queue_nr_dirty_show(struct request_queue *q, char *page)
+{
+ return sprintf(page, "%lld\n", bdi_stat(&q->backing_dev_info, BDI_DIRTY));
+}
+
+static ssize_t queue_nr_writeback_show(struct request_queue *q, char *page)
+{
+ return sprintf(page, "%lld\n", bdi_stat(&q->backing_dev_info, BDI_WRITEBACK));
+}
+
+static ssize_t queue_nr_unstable_show(struct request_queue *q, char *page)
+{
+ return sprintf(page, "%lld\n", bdi_stat(&q->backing_dev_info, BDI_UNSTABLE));
+}
static struct queue_sysfs_entry queue_requests_entry = {
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
@@ -4006,6 +4020,21 @@ static struct queue_sysfs_entry queue_ma
.show = queue_max_hw_sectors_show,
};
+static struct queue_sysfs_entry queue_dirty_entry = {
+ .attr = {.name = "dirty_pages", .mode = S_IRUGO },
+ .show = queue_nr_dirty_show,
+};
+
+static struct queue_sysfs_entry queue_writeback_entry = {
+ .attr = {.name = "writeback_pages", .mode = S_IRUGO },
+ .show = queue_nr_writeback_show,
+};
+
+static struct queue_sysfs_entry queue_unstable_entry = {
+ .attr = {.name = "unstable_pages", .mode = S_IRUGO },
+ .show = queue_nr_unstable_show,
+};
+
static struct queue_sysfs_entry queue_iosched_entry = {
.attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
.show = elv_iosched_show,
@@ -4018,6 +4047,9 @@ static struct attribute *default_attrs[]
&queue_initial_ra_entry.attr,
&queue_max_hw_sectors_entry.attr,
&queue_max_sectors_entry.attr,
+ &queue_dirty_entry.attr,
+ &queue_writeback_entry.attr,
+ &queue_unstable_entry.attr,
&queue_iosched_entry.attr,
NULL,
};
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 11/12] mm: per device dirty threshold
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (9 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 10/12] mm: expose BDI statistics in sysfs Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
2007-04-19 17:49 ` Miklos Szeredi
2007-04-17 7:10 ` [PATCH 12/12] debug: expose BDI statistics in sysfs Peter Zijlstra
11 siblings, 1 reply; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: writeback-balance-per-backing_dev.patch --]
[-- Type: text/plain, Size: 13163 bytes --]
Scale writeback cache per backing device, proportional to its writeout speed.
By decoupling the BDI dirty thresholds a number of problems we currently have
will go away, namely:
- mutual interference starvation (for any number of BDIs);
- deadlocks with stacked BDIs (loop, FUSE and local NFS mounts).
It might be that all dirty pages are for a single BDI while other BDIs are
idling. By giving each BDI a 'fair' share of the dirty limit, each one can have
dirty pages outstanding and make progress.
A global threshold also creates a deadlock for stacked BDIs; when A writes to
B, and A generates enough dirty pages to get throttled, B will never start
writeback until the dirty pages go away. Again, by giving each BDI its own
'independent' dirty limit, this problem is avoided.
So the problem is to determine how to distribute the total dirty limit across
the BDIs fairly and efficiently. A DBI that has a large dirty limit but does
not have any dirty pages outstanding is a waste.
What is done is to keep a floating proportion between the DBIs based on
writeback completions. This way faster/more active devices get a larger share
than slower/idle devices.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/backing-dev.h | 48 +++++++++++
mm/backing-dev.c | 3
mm/page-writeback.c | 185 +++++++++++++++++++++++++++++++++++++-------
3 files changed, 207 insertions(+), 29 deletions(-)
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-16 11:47:14.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-16 11:47:14.000000000 +0200
@@ -29,6 +29,7 @@ enum bdi_stat_item {
BDI_DIRTY,
BDI_WRITEBACK,
BDI_UNSTABLE,
+ BDI_WRITEOUT,
NR_BDI_STAT_ITEMS
};
@@ -44,6 +45,13 @@ struct backing_dev_info {
void *unplug_io_data;
struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
+
+ /*
+ * data used for scaling the writeback cache
+ */
+ spinlock_t lock; /* protect the cycle count */
+ unsigned long cycles; /* writeout cycles */
+ int dirty_exceeded;
};
void bdi_init(struct backing_dev_info *bdi);
@@ -55,6 +63,12 @@ static inline void __mod_bdi_stat(struct
percpu_counter_mod(&bdi->bdi_stat[item], amount);
}
+static inline void __mod_bdi_stat64(struct backing_dev_info *bdi,
+ enum bdi_stat_item item, s64 amount)
+{
+ percpu_counter_mod64(&bdi->bdi_stat[item], amount);
+}
+
static inline void __inc_bdi_stat(struct backing_dev_info *bdi,
enum bdi_stat_item item)
{
@@ -87,12 +101,46 @@ static inline void dec_bdi_stat(struct b
local_irq_restore(flags);
}
+static inline s64 __bdi_stat(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ return percpu_counter_read(&bdi->bdi_stat[item]);
+}
+
static inline s64 bdi_stat(struct backing_dev_info *bdi,
enum bdi_stat_item item)
{
return percpu_counter_read_positive(&bdi->bdi_stat[item]);
}
+static inline s64 __bdi_stat_sum(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ return percpu_counter_sum(&bdi->bdi_stat[item]);
+}
+
+static inline s64 bdi_stat_sum(struct backing_dev_info *bdi,
+ enum bdi_stat_item item)
+{
+ s64 sum;
+ unsigned long flags;
+
+ local_irq_save(flags);
+ sum = __bdi_stat_sum(bdi, item);
+ local_irq_restore(flags);
+
+ return sum;
+}
+
+static inline unsigned long bdi_stat_delta(void)
+{
+#ifdef CONFIG_SMP
+ return NR_CPUS * FBC_BATCH;
+#else
+ return 1UL;
+#endif
+}
+
/*
* Flags in backing_dev_info::capability
* - The first two flags control whether dirty pages will contribute to the
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-16 11:47:14.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-16 16:21:58.000000000 +0200
@@ -49,8 +49,6 @@
*/
static long ratelimit_pages = 32;
-static int dirty_exceeded __cacheline_aligned_in_smp; /* Dirty mem may be over limit */
-
/*
* When balance_dirty_pages decides that the caller needs to perform some
* non-background writeback, this is how many pages it will attempt to write.
@@ -103,6 +101,88 @@ EXPORT_SYMBOL(laptop_mode);
static void background_writeout(unsigned long _min_pages);
/*
+ * Scale the writeback cache size proportional to the relative writeout speeds.
+ *
+ * We do this by tracking a floating average per BDI and a global floating
+ * average. We optimize away the '/= 2' for the global average by noting that:
+ *
+ * if (++i > thresh) i /= 2:
+ *
+ * Can be approximated by:
+ *
+ * thresh/2 + (++i % thresh/2)
+ *
+ * Furthermore, when we choose thresh to be 2^n it can be written in terms of
+ * binary operations and wraparound artifacts disappear.
+ *
+ * Also note that this yields a natural counter of the elapsed periods:
+ *
+ * i / thresh
+ *
+ * Its monotonous increasing property can be applied to mitigate the wrap-
+ * around issue.
+ */
+static int vm_cycle_shift __read_mostly;
+static struct percpu_counter vm_writeout_total;
+
+/*
+ * Sync up the per BDI average to the global cycle.
+ */
+static void bdi_writeout_norm(struct backing_dev_info *bdi)
+{
+ int bits = vm_cycle_shift;
+ unsigned long cycle = 1UL << bits;
+ unsigned long mask = ~(cycle - 1);
+ unsigned long global_cycle = percpu_counter_read(&vm_writeout_total);
+ unsigned long flags;
+
+ global_cycle <<= 1;
+ global_cycle &= mask;
+
+ if ((bdi->cycles & mask) == global_cycle)
+ return;
+
+ spin_lock_irqsave(&bdi->lock, flags);
+ bdi->cycles &= mask;
+ while (bdi->cycles != global_cycle) {
+ unsigned long val = __bdi_stat(bdi, BDI_WRITEOUT);
+ unsigned long half = (val + 1) >> 1;
+
+ if (!val)
+ break;
+
+ __mod_bdi_stat64(bdi, BDI_WRITEOUT, -half);
+ bdi->cycles += cycle;
+ }
+ bdi->cycles = global_cycle;
+ spin_unlock_irqrestore(&bdi->lock, flags);
+}
+
+static void __bdi_writeout_inc(struct backing_dev_info *bdi)
+{
+ bdi_writeout_norm(bdi);
+
+ __inc_bdi_stat(bdi, BDI_WRITEOUT);
+ percpu_counter_mod(&vm_writeout_total, 1);
+}
+
+void get_writeout_scale(struct backing_dev_info *bdi, long *scale, long *div)
+{
+ int bits = vm_cycle_shift - 1;
+ unsigned long cycle = 1UL << bits;
+ unsigned long mask = cycle - 1;
+ unsigned long total = percpu_counter_read(&vm_writeout_total);
+
+ if (bdi_cap_writeback_dirty(bdi)) {
+ bdi_writeout_norm(bdi);
+ *scale = bdi_stat(bdi, BDI_WRITEOUT);
+ } else
+ *scale = 0;
+
+ *div = cycle + (total & mask);
+}
+
+/*
* Work out the current dirty-memory clamping and background writeout
* thresholds.
*
@@ -158,8 +238,8 @@ static unsigned long determine_dirtyable
}
static void
-get_dirty_limits(long *pbackground, long *pdirty,
- struct address_space *mapping)
+get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
+ struct backing_dev_info *bdi)
{
int background_ratio; /* Percentages */
int dirty_ratio;
@@ -193,6 +273,31 @@ get_dirty_limits(long *pbackground, long
}
*pbackground = background;
*pdirty = dirty;
+
+ if (bdi) {
+ long long tmp = dirty;
+ long reserve;
+ long scale, div;
+
+ get_writeout_scale(bdi, &scale, &div);
+
+ tmp *= scale;
+ do_div(tmp, div);
+
+ reserve = dirty -
+ (global_page_state(NR_FILE_DIRTY) +
+ global_page_state(NR_WRITEBACK) +
+ global_page_state(NR_UNSTABLE_NFS));
+
+ if (reserve < 0)
+ reserve = 0;
+
+ reserve += bdi_stat(bdi, BDI_DIRTY) +
+ bdi_stat(bdi, BDI_WRITEBACK) +
+ bdi_stat(bdi, BDI_UNSTABLE);
+
+ *pbdi_dirty = min((long)tmp, reserve);
+ }
}
/*
@@ -204,9 +309,11 @@ get_dirty_limits(long *pbackground, long
*/
static void balance_dirty_pages(struct address_space *mapping)
{
- long nr_reclaimable;
+ long bdi_nr_reclaimable;
+ long bdi_nr_writeback;
long background_thresh;
long dirty_thresh;
+ long bdi_thresh;
unsigned long pages_written = 0;
unsigned long write_chunk = sync_writeback_pages();
@@ -221,15 +328,16 @@ static void balance_dirty_pages(struct a
.range_cyclic = 1,
};
- get_dirty_limits(&background_thresh, &dirty_thresh, mapping);
- nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
- global_page_state(NR_UNSTABLE_NFS);
- if (nr_reclaimable + global_page_state(NR_WRITEBACK) <=
- dirty_thresh)
+ get_dirty_limits(&background_thresh, &dirty_thresh,
+ &bdi_thresh, bdi);
+ bdi_nr_reclaimable = bdi_stat(bdi, BDI_DIRTY) +
+ bdi_stat(bdi, BDI_UNSTABLE);
+ bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
+ if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
break;
- if (!dirty_exceeded)
- dirty_exceeded = 1;
+ if (!bdi->dirty_exceeded)
+ bdi->dirty_exceeded = 1;
/* Note: nr_reclaimable denotes nr_dirty + nr_unstable.
* Unstable writes are a feature of certain networked
@@ -237,16 +345,29 @@ static void balance_dirty_pages(struct a
* written to the server's write cache, but has not yet
* been flushed to permanent storage.
*/
- if (nr_reclaimable) {
+ if (bdi_nr_reclaimable) {
writeback_inodes(&wbc);
- get_dirty_limits(&background_thresh,
- &dirty_thresh, mapping);
- nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
- global_page_state(NR_UNSTABLE_NFS);
- if (nr_reclaimable +
- global_page_state(NR_WRITEBACK)
- <= dirty_thresh)
- break;
+
+ get_dirty_limits(&background_thresh, &dirty_thresh,
+ &bdi_thresh, bdi);
+
+ if (bdi_thresh < bdi_stat_delta()) {
+ bdi_nr_reclaimable =
+ bdi_stat_sum(bdi, BDI_DIRTY) +
+ bdi_stat_sum(bdi, BDI_UNSTABLE);
+ bdi_nr_writeback =
+ bdi_stat_sum(bdi, BDI_WRITEBACK);
+ } else {
+ bdi_nr_reclaimable =
+ bdi_stat(bdi, BDI_DIRTY) +
+ bdi_stat(bdi, BDI_UNSTABLE);
+ bdi_nr_writeback =
+ bdi_stat(bdi, BDI_WRITEBACK);
+ }
+
+ if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
+ break;
+
pages_written += write_chunk - wbc.nr_to_write;
if (pages_written >= write_chunk)
break; /* We've done our duty */
@@ -254,9 +375,9 @@ static void balance_dirty_pages(struct a
congestion_wait(WRITE, HZ/10);
}
- if (nr_reclaimable + global_page_state(NR_WRITEBACK)
- <= dirty_thresh && dirty_exceeded)
- dirty_exceeded = 0;
+ if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
+ bdi->dirty_exceeded)
+ bdi->dirty_exceeded = 0;
if (writeback_in_progress(bdi))
return; /* pdflush is already working this queue */
@@ -270,7 +391,9 @@ static void balance_dirty_pages(struct a
* background_thresh, to keep the amount of dirty memory low.
*/
if ((laptop_mode && pages_written) ||
- (!laptop_mode && (nr_reclaimable > background_thresh)))
+ (!laptop_mode && (global_page_state(NR_FILE_DIRTY)
+ + global_page_state(NR_UNSTABLE_NFS)
+ > background_thresh)))
pdflush_operation(background_writeout, 0);
}
@@ -306,7 +429,7 @@ void balance_dirty_pages_ratelimited_nr(
unsigned long *p;
ratelimit = ratelimit_pages;
- if (dirty_exceeded)
+ if (mapping->backing_dev_info->dirty_exceeded)
ratelimit = 8;
/*
@@ -342,7 +465,7 @@ void throttle_vm_writeout(gfp_t gfp_mask
}
for ( ; ; ) {
- get_dirty_limits(&background_thresh, &dirty_thresh, NULL);
+ get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
/*
* Boost the allowable dirty threshold a bit for page
@@ -377,7 +500,7 @@ static void background_writeout(unsigned
long background_thresh;
long dirty_thresh;
- get_dirty_limits(&background_thresh, &dirty_thresh, NULL);
+ get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
if (global_page_state(NR_FILE_DIRTY) +
global_page_state(NR_UNSTABLE_NFS) < background_thresh
&& min_pages <= 0)
@@ -585,6 +708,8 @@ void __init page_writeback_init(void)
mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
writeback_set_ratelimit();
register_cpu_notifier(&ratelimit_nb);
+ vm_cycle_shift = 1 + ilog2(vm_total_pages);
+ percpu_counter_init(&vm_writeout_total, 0);
}
/**
@@ -986,8 +1111,10 @@ int test_clear_page_writeback(struct pag
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
- if (bdi_cap_writeback_dirty(bdi))
+ if (bdi_cap_writeback_dirty(bdi)) {
__dec_bdi_stat(bdi, BDI_WRITEBACK);
+ __bdi_writeout_inc(bdi);
+ }
}
write_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
Index: linux-2.6/mm/backing-dev.c
===================================================================
--- linux-2.6.orig/mm/backing-dev.c 2007-04-16 11:47:14.000000000 +0200
+++ linux-2.6/mm/backing-dev.c 2007-04-16 11:47:14.000000000 +0200
@@ -12,6 +12,9 @@ void bdi_init(struct backing_dev_info *b
if (!(bdi_cap_writeback_dirty(bdi) || bdi_cap_account_dirty(bdi)))
return;
+ spin_lock_init(&bdi->lock);
+ bdi->cycles = 0;
+ bdi->dirty_exceeded = 0;
for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
percpu_counter_init(&bdi->bdi_stat[i], 0);
}
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 12/12] debug: expose BDI statistics in sysfs.
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
` (10 preceding siblings ...)
2007-04-17 7:10 ` [PATCH 11/12] mm: per device dirty threshold Peter Zijlstra
@ 2007-04-17 7:10 ` Peter Zijlstra
11 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-17 7:10 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: miklos, akpm, neilb, dgc, tomoki.sekiyama.qu, a.p.zijlstra,
nikita, trond.myklebust, yingchao.zhou
[-- Attachment #1: bdi_stat_debug.patch --]
[-- Type: text/plain, Size: 3464 bytes --]
Expose the per BDI stats in /sys/block/<dev>/queue/*
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
block/ll_rw_blk.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
mm/page-writeback.c | 2 +-
2 files changed, 50 insertions(+), 1 deletion(-)
Index: linux-2.6/block/ll_rw_blk.c
===================================================================
--- linux-2.6.orig/block/ll_rw_blk.c 2007-04-12 17:35:03.000000000 +0200
+++ linux-2.6/block/ll_rw_blk.c 2007-04-12 17:36:49.000000000 +0200
@@ -3991,6 +3991,37 @@ static ssize_t queue_nr_unstable_show(st
return sprintf(page, "%lld\n", bdi_stat(&q->backing_dev_info, BDI_UNSTABLE));
}
+extern void get_writeout_scale(struct backing_dev_info *, int *, int *);
+
+static ssize_t queue_nr_cache_ratio_show(struct request_queue *q, char *page)
+{
+ int scale, div;
+
+ get_writeout_scale(&q->backing_dev_info, &scale, &div);
+ scale *= 1024;
+ scale /= div;
+
+ return sprintf(page, "%d\n", scale);
+}
+
+extern void
+get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
+ struct backing_dev_info *bdi);
+
+static ssize_t queue_nr_cache_size_show(struct request_queue *q, char *page)
+{
+ long background, dirty, bdi_dirty;
+ get_dirty_limits(&background, &dirty, &bdi_dirty, &q->backing_dev_info);
+ return sprintf(page, "%ld\n", bdi_dirty);
+}
+
+static ssize_t queue_nr_cache_total_show(struct request_queue *q, char *page)
+{
+ long background, dirty, bdi_dirty;
+ get_dirty_limits(&background, &dirty, &bdi_dirty, &q->backing_dev_info);
+ return sprintf(page, "%ld\n", dirty);
+}
+
static struct queue_sysfs_entry queue_requests_entry = {
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
.show = queue_requests_show,
@@ -4035,6 +4066,21 @@ static struct queue_sysfs_entry queue_un
.show = queue_nr_unstable_show,
};
+static struct queue_sysfs_entry queue_cache_ratio_entry = {
+ .attr = {.name = "cache_ratio", .mode = S_IRUGO },
+ .show = queue_nr_cache_ratio_show,
+};
+
+static struct queue_sysfs_entry queue_cache_size_entry = {
+ .attr = {.name = "cache_size", .mode = S_IRUGO },
+ .show = queue_nr_cache_size_show,
+};
+
+static struct queue_sysfs_entry queue_cache_total_entry = {
+ .attr = {.name = "cache_total", .mode = S_IRUGO },
+ .show = queue_nr_cache_total_show,
+};
+
static struct queue_sysfs_entry queue_iosched_entry = {
.attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
.show = elv_iosched_show,
@@ -4050,6 +4096,9 @@ static struct attribute *default_attrs[]
&queue_dirty_entry.attr,
&queue_writeback_entry.attr,
&queue_unstable_entry.attr,
+ &queue_cache_ratio_entry.attr,
+ &queue_cache_size_entry.attr,
+ &queue_cache_total_entry.attr,
&queue_iosched_entry.attr,
NULL,
};
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-12 17:36:05.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-12 17:36:49.000000000 +0200
@@ -237,7 +237,7 @@ static unsigned long determine_dirtyable
return x + 1; /* Ensure that we never return 0 */
}
-static void
+void
get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
struct backing_dev_info *bdi)
{
--
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-17 7:10 ` [PATCH 09/12] mm: count unstable " Peter Zijlstra
@ 2007-04-19 17:44 ` Miklos Szeredi
2007-04-19 18:12 ` Peter Zijlstra
0 siblings, 1 reply; 21+ messages in thread
From: Miklos Szeredi @ 2007-04-19 17:44 UTC (permalink / raw)
To: a.p.zijlstra
Cc: linux-mm, linux-kernel, miklos, akpm, neilb, dgc,
tomoki.sekiyama.qu, nikita, trond.myklebust, yingchao.zhou
> Count per BDI unstable pages.
>
I'm wondering, is it really worth having this category separate from
per BDI brity pages?
With the exception of the export to sysfs, always the sum of unstable
+ dirty is used.
Miklos
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] mm: per device dirty threshold
2007-04-17 7:10 ` [PATCH 11/12] mm: per device dirty threshold Peter Zijlstra
@ 2007-04-19 17:49 ` Miklos Szeredi
2007-04-19 18:04 ` Peter Zijlstra
0 siblings, 1 reply; 21+ messages in thread
From: Miklos Szeredi @ 2007-04-19 17:49 UTC (permalink / raw)
To: a.p.zijlstra
Cc: linux-mm, linux-kernel, miklos, akpm, neilb, dgc,
tomoki.sekiyama.qu, nikita, trond.myklebust, yingchao.zhou
> +static inline unsigned long bdi_stat_delta(void)
> +{
> +#ifdef CONFIG_SMP
> + return NR_CPUS * FBC_BATCH;
Shouln't this be multiplied by the number of counters to sum? I.e. 3
if dirty and unstable are separate, and 2 if they are not.
Miklos
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] mm: per device dirty threshold
2007-04-19 17:49 ` Miklos Szeredi
@ 2007-04-19 18:04 ` Peter Zijlstra
0 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-19 18:04 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-mm, linux-kernel, akpm, neilb, dgc, tomoki.sekiyama.qu,
nikita, trond.myklebust, yingchao.zhou
On Thu, 2007-04-19 at 19:49 +0200, Miklos Szeredi wrote:
> > +static inline unsigned long bdi_stat_delta(void)
> > +{
> > +#ifdef CONFIG_SMP
> > + return NR_CPUS * FBC_BATCH;
>
> Shouln't this be multiplied by the number of counters to sum? I.e. 3
> if dirty and unstable are separate, and 2 if they are not.
Ah, yes, good catch. How about this:
---
Since we're adding 3 stat counters, tripple the per counter delta as
well.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
mm/page-writeback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-19 19:59:26.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-19 20:00:09.000000000 +0200
@@ -321,7 +321,7 @@ static void balance_dirty_pages(struct a
get_dirty_limits(&background_thresh, &dirty_thresh,
&bdi_thresh, bdi);
- if (bdi_thresh < bdi_stat_delta()) {
+ if (bdi_thresh < 3*bdi_stat_delta()) {
bdi_nr_reclaimable =
bdi_stat_sum(bdi, BDI_DIRTY) +
bdi_stat_sum(bdi, BDI_UNSTABLE);
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-19 17:44 ` Miklos Szeredi
@ 2007-04-19 18:12 ` Peter Zijlstra
2007-04-19 18:46 ` Peter Zijlstra
0 siblings, 1 reply; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-19 18:12 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-mm, linux-kernel, akpm, neilb, dgc, tomoki.sekiyama.qu,
nikita, trond.myklebust, yingchao.zhou
On Thu, 2007-04-19 at 19:44 +0200, Miklos Szeredi wrote:
> > Count per BDI unstable pages.
> >
>
> I'm wondering, is it really worth having this category separate from
> per BDI brity pages?
>
> With the exception of the export to sysfs, always the sum of unstable
> + dirty is used.
I guess you are right, but it offends my sense of aesthetics to break
symmetry with the zone statistics. However, it has the added advantage
of only needing 2 deltas as well.
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-19 18:12 ` Peter Zijlstra
@ 2007-04-19 18:46 ` Peter Zijlstra
2007-04-19 19:00 ` Peter Zijlstra
2007-04-19 19:20 ` Miklos Szeredi
0 siblings, 2 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-19 18:46 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-mm, linux-kernel, akpm, neilb, dgc, tomoki.sekiyama.qu,
nikita, trond.myklebust, yingchao.zhou
On Thu, 2007-04-19 at 20:12 +0200, Peter Zijlstra wrote:
> On Thu, 2007-04-19 at 19:44 +0200, Miklos Szeredi wrote:
> > > Count per BDI unstable pages.
> > >
> >
> > I'm wondering, is it really worth having this category separate from
> > per BDI brity pages?
> >
> > With the exception of the export to sysfs, always the sum of unstable
> > + dirty is used.
>
> I guess you are right, but it offends my sense of aesthetics to break
> symmetry with the zone statistics. However, it has the added advantage
> of only needing 2 deltas as well.
I guess, this should do.
---
fs/buffer.c | 2 +-
fs/nfs/write.c | 11 +++++++----
include/linux/backing-dev.h | 3 +--
mm/page-writeback.c | 16 +++++++---------
mm/truncate.c | 2 +-
5 files changed, 17 insertions(+), 17 deletions(-)
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c 2007-04-19 19:59:26.000000000 +0200
+++ linux-2.6/fs/buffer.c 2007-04-19 20:35:39.000000000 +0200
@@ -733,7 +733,7 @@ int __set_page_dirty_buffers(struct page
if (page->mapping) { /* Race with truncate? */
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
- __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
+ __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIM);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
Index: linux-2.6/fs/nfs/write.c
===================================================================
--- linux-2.6.orig/fs/nfs/write.c 2007-04-19 19:59:26.000000000 +0200
+++ linux-2.6/fs/nfs/write.c 2007-04-19 20:39:03.000000000 +0200
@@ -456,7 +456,7 @@ nfs_mark_request_commit(struct nfs_page
nfsi->ncommit++;
spin_unlock(&nfsi->req_lock);
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
- inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
+ inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIM);
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
}
#endif
@@ -518,7 +518,8 @@ static void nfs_cancel_commit_list(struc
while(!list_empty(head)) {
req = nfs_list_entry(head->next);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
- dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+ BDI_RECLAIM);
nfs_list_remove_request(req);
nfs_inode_remove_request(req);
nfs_unlock_request(req);
@@ -1247,7 +1248,8 @@ nfs_commit_list(struct inode *inode, str
nfs_list_remove_request(req);
nfs_mark_request_commit(req);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
- dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+ BDI_RECLAIM);
nfs_clear_page_writeback(req);
}
return -ENOMEM;
@@ -1272,7 +1274,8 @@ static void nfs_commit_done(struct rpc_t
req = nfs_list_entry(data->pages.next);
nfs_list_remove_request(req);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
- dec_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_UNSTABLE);
+ dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+ BDI_RECLAIM);
dprintk("NFS: commit (%s/%Ld %d@%Ld)",
req->wb_context->dentry->d_inode->i_sb->s_id,
Index: linux-2.6/include/linux/backing-dev.h
===================================================================
--- linux-2.6.orig/include/linux/backing-dev.h 2007-04-19 19:59:26.000000000 +0200
+++ linux-2.6/include/linux/backing-dev.h 2007-04-19 20:39:24.000000000 +0200
@@ -26,9 +26,8 @@ enum bdi_state {
typedef int (congested_fn)(void *, int);
enum bdi_stat_item {
- BDI_DIRTY,
+ BDI_RECLAIM,
BDI_WRITEBACK,
- BDI_UNSTABLE,
BDI_WRITEOUT,
NR_BDI_STAT_ITEMS
};
Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2007-04-19 20:00:09.000000000 +0200
+++ linux-2.6/mm/page-writeback.c 2007-04-19 20:40:29.000000000 +0200
@@ -300,8 +300,7 @@ static void balance_dirty_pages(struct a
get_dirty_limits(&background_thresh, &dirty_thresh,
&bdi_thresh, bdi);
- bdi_nr_reclaimable = bdi_stat(bdi, BDI_DIRTY) +
- bdi_stat(bdi, BDI_UNSTABLE);
+ bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIM);
bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
break;
@@ -321,16 +320,14 @@ static void balance_dirty_pages(struct a
get_dirty_limits(&background_thresh, &dirty_thresh,
&bdi_thresh, bdi);
- if (bdi_thresh < 3*bdi_stat_delta()) {
+ if (bdi_thresh < 2*bdi_stat_delta()) {
bdi_nr_reclaimable =
- bdi_stat_sum(bdi, BDI_DIRTY) +
- bdi_stat_sum(bdi, BDI_UNSTABLE);
+ bdi_stat_sum(bdi, BDI_RECLAIM);
bdi_nr_writeback =
bdi_stat_sum(bdi, BDI_WRITEBACK);
} else {
bdi_nr_reclaimable =
- bdi_stat(bdi, BDI_DIRTY) +
- bdi_stat(bdi, BDI_UNSTABLE);
+ bdi_stat(bdi, BDI_RECLAIM);
bdi_nr_writeback =
bdi_stat(bdi, BDI_WRITEBACK);
}
@@ -907,7 +904,8 @@ int __set_page_dirty_nobuffers(struct pa
BUG_ON(mapping2 != mapping);
if (mapping_cap_account_dirty(mapping)) {
__inc_zone_page_state(page, NR_FILE_DIRTY);
- __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
+ __inc_bdi_stat(mapping->backing_dev_info,
+ BDI_RECLAIM);
task_io_account_write(PAGE_CACHE_SIZE);
}
radix_tree_tag_set(&mapping->page_tree,
@@ -1034,7 +1032,7 @@ int clear_page_dirty_for_io(struct page
set_page_dirty(page);
if (TestClearPageDirty(page)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
- dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
+ dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIM);
return 1;
}
return 0;
Index: linux-2.6/mm/truncate.c
===================================================================
--- linux-2.6.orig/mm/truncate.c 2007-04-19 19:59:26.000000000 +0200
+++ linux-2.6/mm/truncate.c 2007-04-19 20:40:36.000000000 +0200
@@ -71,7 +71,7 @@ void cancel_dirty_page(struct page *page
struct address_space *mapping = page->mapping;
if (mapping && mapping_cap_account_dirty(mapping)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
- dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
+ dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIM);
if (account_size)
task_io_account_cancelled_write(account_size);
}
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-19 18:46 ` Peter Zijlstra
@ 2007-04-19 19:00 ` Peter Zijlstra
2007-04-19 19:20 ` Miklos Szeredi
1 sibling, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-19 19:00 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-mm, linux-kernel, akpm, neilb, dgc, tomoki.sekiyama.qu,
nikita, trond.myklebust, yingchao.zhou
On Thu, 2007-04-19 at 20:46 +0200, Peter Zijlstra wrote:
> On Thu, 2007-04-19 at 20:12 +0200, Peter Zijlstra wrote:
> > On Thu, 2007-04-19 at 19:44 +0200, Miklos Szeredi wrote:
> > > > Count per BDI unstable pages.
> > > >
> > >
> > > I'm wondering, is it really worth having this category separate from
> > > per BDI brity pages?
> > >
> > > With the exception of the export to sysfs, always the sum of unstable
> > > + dirty is used.
> >
> > I guess you are right, but it offends my sense of aesthetics to break
> > symmetry with the zone statistics. However, it has the added advantage
> > of only needing 2 deltas as well.
>
> I guess, this should do.
OK, the compiler told me I messed up :-/. I'll respin the whole series
and repost tomorrow or something...
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-19 18:46 ` Peter Zijlstra
2007-04-19 19:00 ` Peter Zijlstra
@ 2007-04-19 19:20 ` Miklos Szeredi
2007-04-19 19:23 ` Peter Zijlstra
1 sibling, 1 reply; 21+ messages in thread
From: Miklos Szeredi @ 2007-04-19 19:20 UTC (permalink / raw)
To: a.p.zijlstra
Cc: miklos, linux-mm, linux-kernel, akpm, neilb, dgc,
tomoki.sekiyama.qu, nikita, trond.myklebust, yingchao.zhou
> Index: linux-2.6/fs/buffer.c
> ===================================================================
> --- linux-2.6.orig/fs/buffer.c 2007-04-19 19:59:26.000000000 +0200
> +++ linux-2.6/fs/buffer.c 2007-04-19 20:35:39.000000000 +0200
> @@ -733,7 +733,7 @@ int __set_page_dirty_buffers(struct page
> if (page->mapping) { /* Race with truncate? */
> if (mapping_cap_account_dirty(mapping)) {
> __inc_zone_page_state(page, NR_FILE_DIRTY);
> - __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
> + __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIM);
This name suggests it's _under_ reclaim, which is not true. You might
rather want to call it BDI_RECLAIMABLE, or something similar in
meaning.
Miklos
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/12] mm: count unstable pages per BDI
2007-04-19 19:20 ` Miklos Szeredi
@ 2007-04-19 19:23 ` Peter Zijlstra
0 siblings, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2007-04-19 19:23 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-mm, linux-kernel, akpm, neilb, dgc, tomoki.sekiyama.qu,
nikita, trond.myklebust, yingchao.zhou
On Thu, 2007-04-19 at 21:20 +0200, Miklos Szeredi wrote:
> > Index: linux-2.6/fs/buffer.c
> > ===================================================================
> > --- linux-2.6.orig/fs/buffer.c 2007-04-19 19:59:26.000000000 +0200
> > +++ linux-2.6/fs/buffer.c 2007-04-19 20:35:39.000000000 +0200
> > @@ -733,7 +733,7 @@ int __set_page_dirty_buffers(struct page
> > if (page->mapping) { /* Race with truncate? */
> > if (mapping_cap_account_dirty(mapping)) {
> > __inc_zone_page_state(page, NR_FILE_DIRTY);
> > - __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTY);
> > + __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIM);
>
> This name suggests it's _under_ reclaim, which is not true. You might
> rather want to call it BDI_RECLAIMABLE, or something similar in
> meaning.
Yeah, my fingers got lazy on me :-) will instruct them to type more.
--
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>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2007-04-19 19:23 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-17 7:10 [PATCH 00/12] per device dirty throttling -v4 Peter Zijlstra
2007-04-17 7:10 ` [PATCH 01/12] revert per-backing_dev-dirty-and-writeback-page-accounting Peter Zijlstra
2007-04-17 7:10 ` [PATCH 02/12] nfs: remove congestion_end() Peter Zijlstra
2007-04-17 7:10 ` [PATCH 03/12] lib: dampen the percpu_counter FBC_BATCH Peter Zijlstra
2007-04-17 7:10 ` [PATCH 04/12] lib: percpu_counter_mod64 Peter Zijlstra
2007-04-17 7:10 ` [PATCH 05/12] mm: bdi init hooks Peter Zijlstra
2007-04-17 7:10 ` [PATCH 06/12] mm: scalable bdi statistics counters Peter Zijlstra
2007-04-17 7:10 ` [PATCH 07/12] mm: count dirty pages per BDI Peter Zijlstra
2007-04-17 7:10 ` [PATCH 08/12] mm: count writeback " Peter Zijlstra
2007-04-17 7:10 ` [PATCH 09/12] mm: count unstable " Peter Zijlstra
2007-04-19 17:44 ` Miklos Szeredi
2007-04-19 18:12 ` Peter Zijlstra
2007-04-19 18:46 ` Peter Zijlstra
2007-04-19 19:00 ` Peter Zijlstra
2007-04-19 19:20 ` Miklos Szeredi
2007-04-19 19:23 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 10/12] mm: expose BDI statistics in sysfs Peter Zijlstra
2007-04-17 7:10 ` [PATCH 11/12] mm: per device dirty threshold Peter Zijlstra
2007-04-19 17:49 ` Miklos Szeredi
2007-04-19 18:04 ` Peter Zijlstra
2007-04-17 7:10 ` [PATCH 12/12] debug: expose BDI statistics in sysfs Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox