![]() |
Re: [DISCUSS] SDCard Swap Partition Methods..
2 Attachment(s)
@sixwheeledbeast
This is not javascript, you can't simple equal a function to a variable. Here you have your scripts corrected and improved I think. If you don't understand something of the code, just ask ;) Edited to upload a corrected scripts. swapswitch.sh had some stupid errors, I let spaces in assignations between "new" variable the equal and the value. swapswitchejectsd.sh some stupid too but long to explain. |
Re: [DISCUSS] SDCard Swap Partition Methods..
I just increased the SD's swap size to 1.5GB instead of just 768MB in order to increase the time needed between reswap operations.
should probably be much better this way. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Using both swaps on microSD card with backup swap on eMMC (for being able to boot, if microSD refuses to work) is very good. It should be quite easy, to implement it in ereswap - although, for 2 next weeks, I have very limited time for investigating it. Any input - like patches or even improved ereswap - highly appreciated. It would be great, to allow - tuneable by configuration - usage of any variant, no matter of partition layout (2 swaps, 3 swaps, eMMC, microSD...)
BTW, I agree that flip/flop on microSD only is slightly faster and saves eMMC from wear, but it doesn't affect SD card wear&tear - wear leveling is implemented on hardware level of microSD card, so it doesn't matter - for that case - if 1 or 1 partition is used on microSD (flip could be used all the time, with flop being idle, and wear would be exactly same as with flip and flop used one after another). /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Saying that I got my version working too after seeing peter and vi_'s posts. I have started a "talk wiki" page with my latest scripts (IMHO easier than taring them up) In my version I had to move the position of swap0 in the logic part of the script as it was unnessacarily swapping from 0 to 1 then 2 The idea is to move the information to the Main page when complete. @malkavian I don't understand the need for the RANDOM part of your script? http://wiki.maemo.org/Talk:Swap_on_microSD |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Will increase my swap file also (as I fill it up once/twice a day during heavy usage). Quote:
Quote:
But to minize wear to the maximum: what about not disabling flip location, but enabling flop location with higher priority? This will lead to flip still used (only read of old data) and all new swap on flop. Or/and vice versa. This way we do not have the need to move the currently used swap data. Maybe I do not increase, but create second swap .... |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Please see my posts in compcache/ramzwap thread. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
So, it works only, until both swaps hit the limit. But, maybe after giving higher priority for swap 2, we could wait some time, and then quickly disable and re-enable (with still lower priority) swap 1, so it will be ready for taking higher priority again? Due to sitting with lower priority for some time, it should contain low amount of data for read, anyway. /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
But ... Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Quote:
Quote:
Quote:
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Just wait until current swap usage reaches its limit (with some safety margin, e.g. 10% of swap).So start dis-/enabling just shortly before switching.
And do it with lesser nice, like 'nice -20 switchswap.sh' |
Re: [DISCUSS] SDCard Swap Partition Methods..
Worth checking in practice - if dis/ena/-bling, at this point, would be very quickly, it could be done in background, automatically, without user's intervention at all.
OTOH, I've talked with ShadowJK on IRC about that, and he mentioned, that having fragmented swap with lower priority (as when enabling 2nd swap with higher priority, without disabling 1st one), won't work well, as due to flawed implementation, there are still writes occurring on lower-priority (=fragmented) swap: http://mg.pov.lt/maemo-irclog/%23mae...07-13T23:50:36 /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
OK your RANDOM part makes sense now, probably not required tho.
Quote:
Do they work for everyone? Quote:
I started a GUI for ereswap but it got well out of my league. Feel free to take the reigns on the project. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
And, this swap is not yet fragmented, as we start switchswap about 10% (or similar) before maximum reached. Then it should work flawlessly. I did not have any negative effects with my setup (main swap on SD with eMMC always on with lower priority; dis-/reenabling SD swap after 700MB written). |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Code:
run-standalone.sh /home/user/.myscript/swapswitch.sh | sudo gainroot I am certain I have seen some script that is "if not root - sudo me" |
Re: [DISCUSS] SDCard Swap Partition Methods..
i've seen several posts here regarding problems with swap implementation and multiple swap locations/files. are there any patches from meego/mainline we could backport to help?
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Quote:
Code:
#!/bin/sh |
Re: [DISCUSS] SDCard Swap Partition Methods..
Hey guys, I got intrested in the swap switching idea that you have and i'm currently testing it (thou without the scripts, I prefer doing it manualy 'till i'm in testing phase) ..anyway I have few suggestion:
1. As you already said, it needs GUI ... not that i'm really good at GUI programming ...i kind of hate writing GUI stuff, but i'll try to find some free time to help out with that. 2. Adding the possability of automatic reswaping. 3. Don't edit startup scripts! It's a bad idea.... it think it will be better if you add the (or switch to) second swap at a later stage (maybe after Xstart with sleep for $user_defined seconds before X an then doing it) This way you'll only add dbus scripts. 4. Some changes in the scripts..... first one shoud only check if it is time to do the reswaping, and call the seconds one (if needed). The second one will do the actual reswaping. (not sure but I think that currently both scripts can do some of the same stuff, correct me if i'm wrong.... i'm to lazy to check it out right now) 5. About the automatic reswaping... one way to go is to start a script after phone is locked, sleep for 3-4-5 minutes (this can be user defined too) then check if the load is below some value (for example 0.5) and start reswaping if it is time. if the load is grater -> loop on the sleep and check again. Ofc kill the script on phone unlock. Anyway those are just my thoughts on the matter, tell me what you think and (if any) with what can I help :) |
Re: [DISCUSS] SDCard Swap Partition Methods..
True a GUI would be good that's why I started one, but it needs a lot of work.
Automatic Re-swapping can cause problems if your in the middle of something. My method has a separate event.d file (which I personally prefer over editing rcS-late) The two scripts you mention in your method are the same as Ereswap (currently in devel) wiki.maemo.org/Ereswap My method has one script to switch swap (automatically forcing onto uSD if not already) The other script is to switch to internal swap so the uSD/back cover can be removed. If you have Swap on uSD removing the back cover will (in the words of vi_) insta-unmount your swap, which is like pulling a RAM stick out of a desktop. My script is useful for if I need to get in the back while powered up. IIRC (from something I read on TMO) the swapon/swapoff is better done with the N900 unlocked. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Was 384. |
Re: [DISCUSS] SDCard Swap Partition Methods..
But there is no reason for "glitch" to disappear :confused:
I have atm another SD card with real partition and my glitch appeared again once, but only once. It is a class 2 card, whereas the other was/is a class4. So totally confusing... |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
My sdcard is class 10. Also I can open (with 384 mb swap) 8-9 pages only in microb. After that system tells me about "pause and low memory". But conky shows about 100 mb of swap usage. |
Re: [DISCUSS] SDCard Swap Partition Methods..
It's seems silly to make your swap smaller than the standard 768mb.
I would be using between 3-4 times RAM amount upto 4GB swap, then on larger desktops over 4GB, 1:1 ratio is usually more than enough. Too much and too little will only cause problems. |
Re: [DISCUSS] SDCard Swap Partition Methods..
This is known glitch - 600 or more swap is sufficient for having everything working OK, but no less.
Of course, using 1.5GB swap (or more) makes it *much* more comfortable, as times between required reswaps increase considerably. BTW, I've just grasped real SanDisk class 4 microSD 32GB (for 17 USD :D), so I'm going to exploit big swaps very soon ;) /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
ORLY?
Did not know that, thanks. Some more info/link to that? But it does not explain my SGX-alike UI-total-freezes, as I always had 768 MB on SD. And these freezes just came up when I had my eMMC swap fully disabled. Now I again have it online with lesser priority and everything is fine again (yippie). Code:
~# cat /proc/swaps |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Code:
if [ `id -u` != 0 ] ; then Although this "gainroot" script seems to make the banner repeat twice on the eject sd script, not sure how to fix. I don't think large swaps have a benefit. When fragmentation occurs, swapoff will take forever. |
Re: [DISCUSS] SDCard Swap Partition Methods..
@sixwheeledbeast
Did not yet check your scripts completely, but for the multiple banner I do have explanation: please check out last line of my template Code:
#!/bin/sh And for need to change the code by you. I never had the need as i always followed the above rule. So change back, put everything below and test again. About Quote:
(did not test yet, but am pretty sure) |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Which may make reswap painfully long, is many programs opened (which eats memory and increase amount of swap used), as more data need to be reswapped. Thus, it's recommended to reswap without any programs opened (or lightweight ones like terminal). Extreme example of bad idea is reswapping with ED Chromium open, and 10+ tabs with real pages inside. It can take 10 minutes or more to reswap... /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
Sorry to bump this discussion again, but I am interested what people have settled on lately for swap management?
Personally I am swapping manually as required, mainly because I am not keen on ereswap (where it installs it'self, modifing rcs-late). |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
If there is a demand I may take another look at making a swap GUI application. I can understand switching swaps between position 1 and 2 (this is the way I would design my swap app,), but why 3. This is the other reason I am not keen on ereswap you swapon and swapoff twice for no reason at each reswap. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
3 swap partitions was just an example, 2 would be sufficient (one of emmc and one on microsd), but it wouldn't take much effort to make the number unlimited, which may be usefull in some use cases (e.g. someone might have two swap partitions on sd card in order to not use emmc swap at all, but keeps the emmc partition for ability to take the back cover off without rebooting device). |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
When I say "demand" I mean if it is needed. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
1. add/remove swap partitions (no need to automatically detect i guess? that would be too much to ask for;) ) and ability to set the default one selected upon startup and fallback one used when default one is not available during startup 2. set the interval (timer or maybe time of day to do this - maybe alarmd can be used?) when reswaps should be done and between which partitions added in point 1 and in which order (or disabling automatic reswapping) 3. ability to manually reswap to any partition added in point 1 That would be perfect for me... system-ui applet or hildon-home-menu applet, because it would be easily accessible from whole system... Edit: ok, forget th system-ui or hildon-home-menu ideas, maybe a control panel applet would be best, as it is a good place for setting this and maybe there's no need to put more garbage into other places (after all, setting reswap intervals or manual reswapping shouldn't be done that often, so no need for easy access). However, I would hate to have it as a normal application visible on application list. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
PowerMenu seems best place, IMO. In settings belong things you set once (or twice) and never llok at it any further. While settings of the particular swap-parameters could find a nice place in settings.
Would love to have a reswap button in my powerMenu. Right now I am using ereswap + alarmd to do reswap every night. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Edit: Like mr_pingu wrote, set this once and forget it's there untill really needed ;) Edit 2: Or, maybe split it - in config panel, the setup of swap partitions and automatic reswapping schedule and in power menu just option to stop automatic reswapping and performing a manual reswap. What do you think? |
All times are GMT. The time now is 04:56. |
vBulletin® Version 3.8.8