Page MenuHomeFreeBSD

Free rather than cache pages in vm_pageout_scan().
ClosedPublic

Authored by alc on Jun 13 2015, 6:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 12 2024, 1:34 AM
Unknown Object (File)
Oct 20 2023, 10:27 AM
Unknown Object (File)
Apr 15 2023, 2:53 AM
Unknown Object (File)
Apr 17 2017, 11:35 PM
Unknown Object (File)
Mar 19 2017, 5:52 AM
Unknown Object (File)
Jan 19 2017, 10:54 PM
Unknown Object (File)
Nov 11 2016, 3:08 PM
Unknown Object (File)
Oct 27 2016, 6:18 PM
Subscribers
None

Details

Summary

As the next step in eliminating PG_CACHE pages, I am proposing to free rather than cache pages in vm_pageout_scan().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alc retitled this revision from to Free rather than cache pages in vm_pageout_scan()..
alc updated this object.
alc edited the test plan for this revision. (Show Details)
alc added reviewers: jhb, kib, kmacy.

Does it make sense to cut the tail in many small chunks ?

Why not replace all calls to vm_page_cache/vm_page_try_to_cache with the free in the single step ? Or make these two functions to free the page. Removing the cache code is obviously different question.

Here is some data from tests with PostgreSQL 9.3.7.

I've configured PostgreSQL to use 1/4 of DRAM as shared buffers. My database is 3 times larger than DRAM, I'm using the select-only workload for 30 minutes at a time.

There is a slight drop in TPS.

Before:

tps = 7856.441823 (including connections establishing)
tps = 7932.149083 (including connections establishing)
tps = 7933.584812 (including connections establishing)
tps = 7932.831139 (including connections establishing)
tps = 7935.023572 (including connections establishing)
tps = 7942.407592 (including connections establishing)
tps = 7949.623617 (including connections establishing)
tps = 7942.221710 (including connections establishing)

1147293397 pages were cached over the course of these 8 runs, but only 0.46% of them were reactivated.

After:

tps = 7847.534150 (including connections establishing)
tps = 7910.332619 (including connections establishing)
tps = 7925.766889 (including connections establishing)
tps = 7929.057218 (including connections establishing)
tps = 7916.481657 (including connections establishing)
tps = 7916.523477 (including connections establishing)
tps = 7914.272227 (including connections establishing)
tps = 7915.479444 (including connections establishing)

Virtually all of the pages examined by the page daemon are cached or freed, depending on the test, since this is a select-only workload. For example, in the before test, there are:

1182791179 pages examined by the page daemon

...

1147293397 pages cached

So, I also measured the time spent in the inactive queue scan using rdtsc().

Before: 2027760128901
After: 1698644621449

In other words, freeing rather than caching the pages reduces the time spent in the inactive scan by almost 1/6.

In D2805#53825, @kib wrote:

Does it make sense to cut the tail in many small chunks ?

Why not replace all calls to vm_page_cache/vm_page_try_to_cache with the free in the single step ? Or make these two functions to free the page. Removing the cache code is obviously different question.

Different use cases of PG_CACHE pages have different characteristics, in particular, reactivation rates. I'm going case-by-case to isolate the effects that each one has.

kib edited edge metadata.
This revision is now accepted and ready to land.Jun 13 2015, 6:50 PM

Kostik, could you possibly look at a couple of semi-related items? First, we are reacquiring the inactive queue lock in vm_page_free(). I wonder if this reacquire could be safely eliminated, by dequeueing the page when the marker is inserted. This will, of course, require some changes to the other cases in the inactive queue scan. Second, it seems to me that the "(m->valid == 0)" case should come sooner. That's why this patch doesn't merge the "(m->dirty == 0)" case with the "(m->valid == 0)" case.

If you have time to create a patch, I'll benchmark it.

This revision was automatically updated to reflect the committed changes.