yeah long but thx!<br><br><div class="gmail_quote">2010/9/1 Gennady Kupava <span dir="ltr">&lt;<a href="mailto:gb@bsdmn.com">gb@bsdmn.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

В Срд, 01/09/2010 в 12:38 +0200, David Garabana Barro пишет:<br>
&gt;<br>
&gt; It&#39;s not true for me, and it&#39;s a common misunderstanding IMHO.<br>
<br>
This is not misunderstanding, this is just one of questions which can&#39;t<br>
have only one answer. For some tasks swap is good, for others - bad. I<br>
have strong (enough for me) arguments too. Yours are strong for you, so<br>
this is just matter of situation.<br>
<br>
&gt;<br>
&gt; For testing, simply try to download tiles at zoom level 11, for the upper 6<br>
&gt; zoom levels in tangoGPS. Better if you make it twice (moving on the map)<br>
&gt;<br>
&gt; Without swap, it will catch all available memory, and FR will get really<br>
&gt; slooooow, to the limit of appearing to hang, and even sometimes oomkill will<br>
&gt; start killing some random process.<br>
&gt; With swap, linux can swap unused pages (other daemon pages, not tangogps ones)<br>
&gt; and tangogps will continue running, and FR will be responsible. You only will<br>
&gt; notice some 1-4 seconds slowdown from time to time, when pages are swapped out<br>
&gt;<br>
&gt; swap is not only for &quot;creating&quot; more memory. If FR starts to massively trashing<br>
&gt; pages to swap, it will really SLOW things a lot, for sure (the same is true for<br>
&gt; your PC)<br>
&gt;<br>
&gt; But it will help *a lot* to have more memory available for running apps.<br>
&gt; Think on swap as a place where put unused memory pages, and use real RAM for<br>
&gt; currently used apps or caching files from slow uSD<br>
&gt;<br>
&gt; Swap will *ALLWAYS* help, but will help a lot more on a limited memory device,<br>
&gt; as FR<br>
&gt;<br>
&gt; Here [1] you can read more about what I&#39;m saying.<br>
&gt;<br>
&gt; [1] <a href="http://kerneltrap.org/node/3202" target="_blank">http://kerneltrap.org/node/3202</a><br>
<br>
Thanks for description, now my position:<br>
<br>
First of all, i do not use swap on any Linux system i am using with<br>
amount of memory &gt;=512Mb. I even do not use swap on desktop where i have<br>
tmpfs mounted to /tmp.<br>
<br>
Having something published on kerneltrap is not meant to be only<br>
possible answer, i can provide an example. Few years ago Linus believed<br>
that moving everything to userspace is good idea and this is way to go.<br>
Now i see everything is included to kernel (devfs vs udev, evdev vs<br>
tslib, kms vs userspace mode switching). But i am still at the point<br>
that every possible thing should be in userspace. I think, both points<br>
of view very extensivly published to mailing lists and both have strong<br>
grounds :)<br>
<br>
First, about swap in general. IMO, swap were introduced in absolutely<br>
different context. In 80&#39;s memory situation were completely different.<br>
<br>
---<br>
now, real situations.<br>
<br>
1. main swap problem is in it&#39;s nature. it will push to disk<br>
less-frequently used pages from memory but use &#39;freed memory&#39;. But for<br>
me it turned out that it is impossible to predict which page is useful<br>
which is not _in future_, and it turns out that freed memory on all<br>
modern systems used to keep relatively useless huge disk cache. it&#39;s<br>
question (for me) is _huge_ disk cache is better than _meduim-sized_<br>
disk cache in many situations. note that I found that using tmpfs is<br>
times faster than using such &#39;buffer&#39; (i tested qtmoko build). having<br>
random process swapped-out also makes system very unpredictive. you may<br>
never know how long some application will start, this annoying for me, i<br>
like low latency.<br>
<br>
1a. to apply (1) to FR. imagine you have phone app in background. it got<br>
swapped out as you did last call 8 hours ago. now, you recieve call and<br>
what? you should wait for your app to be paged back even to start<br>
hearing ring! considering fr sd io speed is 2.6M/s, and your app is for<br>
example 10M, this will take 4 seconds in best case. something have to be<br>
also discarded from memory too free up that 10M before loading your<br>
phone app.<br>
<br>
2. situation (2) is described in [1] you pointed. i personally face it<br>
tons of times - some program (last were firefox and midming commander)<br>
just run out memory due to bug or other reasons and starts incrementally<br>
requesting swap. if you unlicky (and do not kill app in 30 seconds), you<br>
may get your terminal and most of X be unloaded to swap, and only thing<br>
you can do after that is hard reset. introducing limits will kill only<br>
really useful feature of swap - being able to load something larger than<br>
memory (3)<br>
<br>
3. about your favorite gps application. i think it should create file<br>
and map it to memory instead of using extreme amounts of ram to store<br>
all data. In older day of swap not all systems had such ability. It&#39;s<br>
strange that sometimg became &#39;slow&#39;. without swap it should never become<br>
slow, it should be just oomkilled. in fact, i do not understand this<br>
problem very well, as i think that just next malloc should return 0, or<br>
new throw bad_alloc.<br>
<br>
4. swap on nand is special story. recently i saw really interesting<br>
article on this topic (by DocScrutinizer i think). as nand has block<br>
size of &gt;4kb, writing (and reading) scatter pages (4k) to it may be very<br>
slow process.<br>
<br>
5. if your distribution is on internal NAND, it may be several times<br>
faster to reload application from internal flash than to swap from sd.<br>
<br>
So, i can see that i only had problems with swap and never had real<br>
_need_ to use it.<br>
And, because of all this i am not using swap on any of my systems,<br>
including fr, so i have predictible and error-prone systems.<br>
<br>
PS. I have one other thing to rant laying near this question. I can see<br>
many statements that swap file is same to swap partition, but i can&#39;t<br>
believe it is true - fs appears between disk and memory management<br>
system. For magnetic hdd this means fragmentation, which can decrease<br>
performance below anything. Also, typical modern HDD has x2 (two times)<br>
speed difference between reading first and last sector, so it is<br>
important to place swap to proper location (depends on HDD).<br>
<br>
PPS. whooh, i knew that it will be long...<br>
<br>
Gennady.<br>
<br>
<br>
_______________________________________________<br>
Openmoko community mailing list<br>
<a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
<a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
</blockquote></div><br>