Hi Matthew,
On Tue, Aug 17, 2010 at 03:50:01PM -0400, Matthew Wilcox wrote:
I have not forgotten about it. I just have a hard time reproducing
those extreme stalls you observed.
Running that test on a 2.5GHz machine with 2G of memory gives me
stalls of up to half a second. The patchset I am experimenting with
gets me down to peaks of 70ms, but it needs further work.
Mapped file pages get two rounds on the LRU list, so once the VM
starts scanning, it has to go through all of them twice and can only
reclaim them on the second encounter.
At that point, since we scan without making progress, we start waiting
for IO, which is not happening in this case, so we sit there until a
timeout expires.
This stupid-waiting can be improved, and I am working on that. But
since I can not reproduce your observations, I don't know if this is
the (sole) source of the problem. Can I send you patches?
This is similar to one of my test cases for:
6457474 vmscan: detect mapped file pages used only once
31c0569 vmscan: drop page_mapping_inuse()
dfc8d63 vmscan: factor out page reference checks
because the situation was even worse before (see the series
description in dfc8d63). Maybe asking the obvious, but the kernel you
tested on did include those commits, right?
And just to be sure, I sent you a test-patch to disable the used-once
detection on IRC the other day. Did you have time to run it yet?
Here it is again:
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9c7e57c..c757bba 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -584,6 +584,7 @@ static enum page_references page_check_references(struct page *page,
return PAGEREF_RECLAIM;
if (referenced_ptes) {
+ return PAGEREF_ACTIVATE;
if (PageAnon(page))
return PAGEREF_ACTIVATE;
/*
We can probably do something like the following, but I am not sure
this is a good fix, either. How many applications are using
madvise()?
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -495,7 +495,7 @@ int page_referenced_one(struct page *pag
* mapping is already gone, the unmap path will have
* set PG_referenced or activated the page.
*/
- if (likely(!VM_SequentialReadHint(vma)))
+ if (likely(!(vma->vm_flags & (VM_SEQ_READ|VM_RAND_READ))))
referenced++;
}
--