diff options
author | Alan Cox <alc@FreeBSD.org> | 2010-05-02 17:33:46 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2010-05-02 17:33:46 +0000 |
commit | b88b6c9d80ed2e1ad85a6b928e2c9346a41aced6 (patch) | |
tree | 800dba3ed92fa905f4e1acbc91746a06e2e47bc9 /sys/vm/vm_fault.c | |
parent | f6c8c187d4c03431d69b785ed2a71e18821fe570 (diff) | |
download | src-b88b6c9d80ed2e1ad85a6b928e2c9346a41aced6.tar.gz src-b88b6c9d80ed2e1ad85a6b928e2c9346a41aced6.zip |
It makes no sense for vm_page_sleep_if_busy()'s helper, vm_page_sleep(),
to unconditionally set PG_REFERENCED on a page before sleeping. In many
cases, it's perfectly ok for the page to disappear, i.e., be reclaimed by
the page daemon, before the caller to vm_page_sleep() is reawakened.
Instead, we now explicitly set PG_REFERENCED in those cases where having
the page persist until the caller is awakened is clearly desirable. Note,
however, that setting PG_REFERENCED on the page is still only a hint,
and not a guarantee that the page should persist.
Notes
Notes:
svn path=/head/; revision=207530
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r-- | sys/vm/vm_fault.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index d9cf63e9b11f..5ee4ab439a0c 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -338,6 +338,12 @@ RetryFault:; * to pmap it. */ if ((fs.m->oflags & VPO_BUSY) || fs.m->busy) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_flag_set(fs.m, PG_REFERENCED); vm_page_unlock_queues(); vm_page_unlock(fs.m); VM_OBJECT_UNLOCK(fs.object); |