lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 04 Oct 2012 20:23:50 +0400
From:	Konstantin Khlebnikov <khlebnikov@...nvz.org>
To:	Hugh Dickins <hughd@...gle.com>
CC:	Shaohua Li <shli@...nel.org>, Rik van Riel <riel@...hat.com>,
	Minchan Kim <minchan@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Wu Fengguang <fengguang.wu@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH RFC] mm/swap: automatic tuning for swapin readahead

Here results of my test. Workload isn't very realistic, but at least it 
threaded: compiling linux-3.6 with defconfig in 16 threads on tmpfs,
512mb ram, dualcore cpu, ordinary hard disk. (test script in attachment)

average results for ten runs:

		RA=3	RA=0	RA=1	RA=2	RA=4	Hugh	Shaohua
real time	500	542	528	519	500	523	522
user time	738	737	735	737	739	737	739
sys time	93	93	91	92	96	92	93
pgmajfault	62918	110533	92454	78221	54342	86601	77229
pgpgin		2070372	795228	1034046	1471010	3177192	1154532	1599388
pgpgout		2597278	2022037	2110020	2350380	2802670	2286671	2526570
pswpin		462747	138873	202148	310969	739431	232710	341320
pswpout		646363	502599	524613	584731	697797	568784	628677

So, last two columns shows mostly equal results: +4.6% and +4.4% in comparison 
to vanilla kernel with RA=3, but your version shows more stable results 
(std-error 2.7% against 4.8%) (all this numbers in huge table in attachment)



Numbers from your tests formatted into table for better readability
				
HDD		Vanilla	Shaohua	RA=3	RA=0	RA=4
SEQ, ANON	73921	76210	75611	121542	77950
SEQ, SHMEM	73601	73176	73855	118322	73534
RND, ANON	895392	831243	871569	841680	863871
RND, SHMEM	1058375	1053486	827935	756489	834804

SDD		Vanilla	Shaohua	RA=3	RA=0	RA=4
SEQ, ANON	24634	24198	24673	70018	21125
SEQ, SHMEM	24959	24932	25052	69678	21387
RND, ANON	43014	26146	28075	25901	28686
RND, SHMEM	45349	45215	28249	24332	28226

Hugh Dickins wrote:
> On Tue, 2 Oct 2012, Konstantin Khlebnikov wrote:
>> Hugh Dickins wrote:
>>>
>>> If I boot with mem=900M (and 1G swap: either on hard disk sda, or
>>> on Vertex II SSD sdb), and mmap anonymous 1000M (either MAP_PRIVATE,
>>> or MAP_SHARED for a shmem object), and either cycle sequentially round
>>> that making 5M touches (spaced a page apart), or make 5M random touches,
>>> then here are the times in centisecs that I see (but it's only elapsed
>>> that I've been worrying about).
>>>
>>> 3.6-rc7 swapping to hard disk:
>>>       124 user    6154 system   73921 elapsed -rc7 sda seq
>>>       102 user    8862 system  895392 elapsed -rc7 sda random
>>>       130 user    6628 system   73601 elapsed -rc7 sda shmem seq
>>>       194 user    8610 system 1058375 elapsed -rc7 sda shmem random
>>>
>>> 3.6-rc7 swapping to SSD:
>>>       116 user    5898 system   24634 elapsed -rc7 sdb seq
>>>        96 user    8166 system   43014 elapsed -rc7 sdb random
>>>       110 user    6410 system   24959 elapsed -rc7 sdb shmem seq
>>>       208 user    8024 system   45349 elapsed -rc7 sdb shmem random
>>>
>>> 3.6-rc7 + Shaohua's patch (and FAULT_FLAG_RETRY check in do_swap_page),
>>> HDD:
>>>       116 user    6258 system   76210 elapsed shli sda seq
>>>        80 user    7716 system  831243 elapsed shli sda random
>>>       128 user    6640 system   73176 elapsed shli sda shmem seq
>>>       212 user    8522 system 1053486 elapsed shli sda shmem random
>>>
>>> 3.6-rc7 + Shaohua's patch (and FAULT_FLAG_RETRY check in do_swap_page),
>>> SSD:
>>>       126 user    5734 system   24198 elapsed shli sdb seq
>>>        90 user    7356 system   26146 elapsed shli sdb random
>>>       128 user    6396 system   24932 elapsed shli sdb shmem seq
>>>       192 user    8006 system   45215 elapsed shli sdb shmem random
>>>
>>> 3.6-rc7 + my patch, swapping to hard disk:
>>>       126 user    6252 system   75611 elapsed hugh sda seq
>>>        70 user    8310 system  871569 elapsed hugh sda random
>>>       130 user    6790 system   73855 elapsed hugh sda shmem seq
>>>       148 user    7734 system  827935 elapsed hugh sda shmem random
>>>
>>> 3.6-rc7 + my patch, swapping to SSD:
>>>       116 user    5996 system   24673 elapsed hugh sdb seq
>>>        76 user    7568 system   28075 elapsed hugh sdb random
>>>       132 user    6468 system   25052 elapsed hugh sdb shmem seq
>>>       166 user    7220 system   28249 elapsed hugh sdb shmem random
>>>
>>
>> Hmm, It would be nice to gather numbers without swapin readahead at all, just
>> to see the the worst possible case for sequential read and the best for
>> random.
>
> Right, and also interesting to see what happens if we raise page_cluster
> (more of an option than it was, with your or my patch scaling it down).
> Run on the same machine under the same conditions:
>
> 3.6-rc7 + my patch, swapping to hard disk with page_cluster 0 (no readahead):
>      136 user   34038 system  121542 elapsed hugh cluster0 sda seq
>      102 user    7928 system  841680 elapsed hugh cluster0 sda random
>      130 user   34770 system  118322 elapsed hugh cluster0 sda shmem seq
>      160 user    7362 system  756489 elapsed hugh cluster0 sda shmem random
>
> 3.6-rc7 + my patch, swapping to SSD with page_cluster 0 (no readahead):
>      138 user   32230 system   70018 elapsed hugh cluster0 sdb seq
>       88 user    7296 system   25901 elapsed hugh cluster0 sdb random
>      154 user   33150 system   69678 elapsed hugh cluster0 sdb shmem seq
>      166 user    6936 system   24332 elapsed hugh cluster0 sdb shmem random
>
> 3.6-rc7 + my patch, swapping to hard disk with page_cluster 4 (default + 1):
>      144 user    4262 system   77950 elapsed hugh cluster4 sda seq
>       74 user    8268 system  863871 elapsed hugh cluster4 sda random
>      140 user    4880 system   73534 elapsed hugh cluster4 sda shmem seq
>      160 user    7788 system  834804 elapsed hugh cluster4 sda shmem random
>
> 3.6-rc7 + my patch, swapping to SSD with page_cluster 4 (default + 1):
>      124 user    4242 system   21125 elapsed hugh cluster4 sdb seq
>       72 user    7680 system   28686 elapsed hugh cluster4 sdb random
>      122 user    4622 system   21387 elapsed hugh cluster4 sdb shmem seq
>      172 user    7238 system   28226 elapsed hugh cluster4 sdb shmem random
>
> I was at first surprised to see random significantly faster than sequential
> on SSD with readahead off, thinking they ought to come out the same.  But
> no, that's a warning on the limitations of the test: with an mmap of 1000M
> on a machine with mem=900M, the page-by-page sequential is never going to
> rehit cache, whereas the random has a good chance of finding in memory.
>
> Which I presume also accounts for the lower user times throughout
> for random - but then why not the same for shmem random?
>
> I did start off measuring on the laptop with SSD, mmap 1000M mem=500M;
> but once I transferred to the desktop, I rediscovered just how slow
> swapping to hard disk can be, couldn't wait days, so made mem=900M.
>
>> I'll run some tests too, especially I want to see how it works for less
>> synthetic workloads.
>
> Thank you, that would be valuable.  I expect there to be certain midway
> tests on which Shaohao's patch would show up as significantly faster,
> where his per-vma approach would beat the global approach; then the
> global to improve with growing contention between processes.  But I
> didn't devise any such test, and hoped Shaohua might have one.
>
> Hugh


Download attachment "test-linux-build.sh" of type "application/x-sh" (370 bytes)

View attachment "test-linux-build-results.txt" of type "text/plain" (1194 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ