Best swapper settings for performance? - myTouch 3G, Magic Android Development

Hello again all. I have been using Fatal1ty's Hero builds for a while now which are fantastic Thank you again Fatal1ty. But no matter what i seem to set swapper to it makes the phone run really slow. When I actually disable swapper is when this build runs the smoothest for me. Was wondering what settings everyone here uses for swapper to get the performance increase from it.
currently is set to the following
/sdcard/swapfile.swp
65mb
20 swapiness
i have tried 20 60 and 100 swapiness with upto 256 mb and really didn't seem to help. just wondering what settings that everyone else uses to have it run more speedy. Also I was wondering if it is possible to put to system memory like in the space for applications although I think that may be a bad idea depending on type of memory as will more then likely make that memory fail with all the read / write cycles

Related

Ram usaged with WM 6.5

Hi,
After i upgraded to WM 6.5 Stock, my ram consumption has gone up from 45% with WM 6.1 to around 65-70%.
What are your thoughts about using a tool to free ram - does it help?
And what is the best tool to free ram?
I don't think it'll help. The official rom is badly bloated.
My build uses all of the official Packages on top of the latest WM6.5.1 build 23506 and memory usage is about 34%. That's running the official Manila 2.1
So I have no idea what they're doing.
VM 6.5 and memory usage
Well another approach to the memory usage is, how to get it down?
Is there anyt tips & tricks to get it down?
How much memory do you need in spar befor is a problem and have influence on the performance of the phone?
Its true that 6.5 uses more ram, and even more is used if you have moved over to manila 2.5. But as long as you have ram free it should not affect the performance of your device.
clean ram programs do reduce ram usage that has increased over a few days but you will not get it below the amount that is used just after a soft reset.
Sometimes having things "cached" in the ram will improve device response if those items are needed frequently, so not all ram usuage is actually bad.
Hey guys,
found it on another board (pocketpc.ch)
HKLM\SOFTWARE\HTC\ResProxy\ShareMemSize set Value to 100001
i dit it and its amazing, after a softreset it starts with 42% of memoryusage and til now no problems with any apps, so i think its a good tweek
thanks to the poster on pocketpc.ch
rol13 said:
Hey guys,
found it on another board (pocketpc.ch)
HKLM\SOFTWARE\HTC\ResProxy\ShareMemSize set Value to 100001
i dit it and its amazing, after a softreset it starts with 42% of memoryusage and til now no problems with any apps, so i think its a good tweek
thanks to the poster on pocketpc.ch
Click to expand...
Click to collapse
That was f...... amazing!!!
Memory use is down to 48% and the small delay there sometimes was in the interface is totaly gone. Startup of apps is also faster then before and everything seems faster.
So for now this registry change has done wonders for me. Only time will tell if there is a down side to it ;-)
Thanks rol13.
rol13 said:
Hey guys,
found it on another board (pocketpc.ch)
HKLM\SOFTWARE\HTC\ResProxy\ShareMemSize set Value to 100001
i dit it and its amazing, after a softreset it starts with 42% of memoryusage and til now no problems with any apps, so i think its a good tweek
thanks to the poster on pocketpc.ch
Click to expand...
Click to collapse
Hi,
it's not obvious(no A to F letters to guess) but you might have said, it's an hexadecimal value
regards
I noticed the same problem after updating tot 6.5.
I'm not very experienced with tweaking my phone. How can I use the mentioned tweek? What do I have to do and are ther risks involved?
there is always a risk when tweaking your phone, however, since many of us here seem to be having to negative results from this tweak, then you can say it's safe. search xda for regedit, download and install on your device, then use that program to tweak.
What Registry Base?
I dont understand, when I set the value to 100001, the radio button base has to be selected 'Hex' or 'Dec'?
Thanks for your help!
fofo13 said:
I dont understand, when I set the value to 100001, the radio button base has to be selected 'Hex' or 'Dec'?
Thanks for your help!
Click to expand...
Click to collapse
select hex
jetbro said:
select hex
Click to expand...
Click to collapse
Thank you, done, works just fine.
Thanks works great, usage at 42% now
if your using htc sense try getting the 'no push internet' cab file, as that will stop the push internet service on your phones and save you around 10%
for thoses that are unsure, push internet is where htc sense, will auto load web pages for you every hour or so, this makes the first page load instantly, and thats about it, so not much to lose out on
I would like to add a small note about this tweak before we all start thinking this is giving us something for nothing.
this reg tweak will prevent TD2 from pre-caching files for the following HTC applications:
AudioBooster, Calculator, ContactCard, CUIHandler, FMRadio, HTCAlbum, QuickGPS, Recorder, StreamingPlayer and YouTube.
They will now be dynamically cached, and then dumped from ram as they are used.
If you frequently using these apps it will be slower to launch when you 1st use them as they will need to be moved to memory before being executed (you can prove this yourself buy timing them before and after using the reg edit)
If you look at many diamond/TD2/HD tweaks the performance ones that make most difference are for file system cache, font cache, glyphy cache ect...
This works by allowing greater amounts of memory to be used by these caches, and more cached data gives better performance at the cost of less available memory.
so long as you always have enough free memory for the apps you want to run these performance tweaks are good. but if you go too far and run out of memory your app will crash or phone will just start to crawl
So using your memory is not a problem, and for many people it is better to have common apps and system files cached in memory ready to use instead of being able to see 50% free memory doing nothing (remember you have paid for this memory, make it work for you)
But if shortage of free memory is a problem for you then certainly this tweak will free up ram for your applications that need it.
as a side note another good way of freeing up alot of ram is to dissable push internet using a cab found on these forums. this obviosly comes at the cost of losing push internet, but if you dont use it whats the loss
thanks for the great info rumpleforeskin. one thing i would like to mention, after applying the tweak, my internet speed (using 3g) dropped significantly, and it was almost impossible to get a gps signal, as soon as i restored my registry back to the way it was before the tweak, everything went back to normal, i got my 3g speed back, and gps was almost instant. something to think about before using this tweak! or maybe it was just me
rol13 said:
Hey guys,
found it on another board (pocketpc.ch)
HKLM\SOFTWARE\HTC\ResProxy\ShareMemSize set Value to 100001
i dit it and its amazing, after a softreset it starts with 42% of memoryusage and til now no problems with any apps, so i think its a good tweek
thanks to the poster on pocketpc.ch
Click to expand...
Click to collapse
Brilliant! Down to 52% after a soft reset, thanks.
In my case Topaz from Spain, Official Rom upgrade from HTC, after change the value & soft reset 41% Ram occuped (before the change 48%), without problems with programs,
great tweak.
this tweak sets the share memory to 1 mb while the default is 15 mb.
yes you will have some more ram free but this will make Topaz work much more because now it has to read write to the ram all the time.
so whats good with this tweak
You get extra 5-10 mb ram free (thats what you think) but those extra ram are not free really because they will be used all the time to read what should already be in the ram.
this also causes the cpu to work more causing more drain on the battery.
so you will loose more then you gain
gullum said:
this tweak sets the share memory to 1 mb while the default is 15 mb.
yes you will have some more ram free but this will make Topaz work much more because now it has to read write to the ram all the time.
so whats good with this tweak
You get extra 5-10 mb ram free (thats what you think) but those extra ram are not free really because they will be used all the time to read what should already be in the ram.
this also causes the cpu to work more causing more drain on the battery.
so you will loose more then you gain
Click to expand...
Click to collapse
what you write is true, i made a post a little futher back describing the pupose of this cache file, and all cache files.
The original poster of this tweak done a good job of finding a way to reduce ram usage which will be very helpfull to the few people who need to use that extra ram.
but i worry that many people will use this tweak just to lower their ram usage not understanding that memory cache is there to boost performance.

[IDEA] Smart Swapper

I was thinking the other day about people opinions about using swaps and what the swappiness should be set to. I thought about how at sometimes during heavy use a higher swappiness would help while at other times it could slow things down. I was wondering if it would be possible to make a "smart" Swapper app that ran in the background and automatically adjusted the swappiness according to how much free memory is needed. For example when the phone is idle in your pocket swappiness would be at 10 but then as your started to browse the web or use GPS it would increase swappiness to allow you to have more free memory. Feel free to tell me why this is not practical or possible, it was just a thought I had.
I don't this its a case of being impossible
the question is why?
if your phone is 'sleeping' it probably isn't doing much with swap, so reducing swappiness won't achieve anything.
increasing swappiness when your phone comes to some load threshold will only increase the 'load' on swap as all of a sudden you want to dump more stuff from real memory into swap
tbh I don't understand why so many are obsessed with swap.
my advice , keep swappiness at default, and as for size of swap, large
why large?
good question, as you never really fill more than 40mb..
the reason for 'large' is 'wear levelling' your swap takes a hammering, if this partition is large then each block is going to have less writes on it than a smaller swap partition over a given period of time, thus increasing the life span of your sd card.
Agreed, playing with swappiness doesn't really help a whole lot.
One of the bigger issues (imo) is how once you have swap turned on the kernel will swap inactive pages out in order to make room for IO caching. If your device is sleeping, a lot of pages are suddenly inactive.
While at first it might seem like you'd want the ram to make up for a slow SD card, swapping out to the same device in order to make room for cache is counterintuitive. Unfortunately there is no way to cap the total amount of ram that can be used for cache. The logic is that unused ram and inactive pages can be put to better use to speed up IO.....except on devices with extremely limited ram and IO like most smartphones.
It's pretty unlikely that anything like that will make it back into the linux kernel any time soon. :\
Then again you never know Lunix is open sourced as well as android anything is possible
The idea is correct, but as said, it isn't possible. Don't count on any linux changes in the future on this. On the other hand, i think there is a possibility, but this should be calculated.
Swapiness is set on boot, right? If i change it when running my phone, would this make any difference on further use?
Now my suggestion is, find out what swapiness is ideal. When the program can calculate the ideal swapiness level, based on how much RAM is used over time, this would be nice? It would write this level down in a userinit, and when you reboot the phone, it would use this level as a reference point on swapiness.
Only downside is that you can't figure out the ideal swapiness, it depends on the phone, apps and personal preference.
Anyone has comments on this idea?

[Idea]add memory to myTouch

Originally, a2sd was developed to allow installation of many apps on G1 as G1 has limited memory. The MT3G has more internal memory so it does not need a2sd.
My question is if we can enable a2sd on a MT3G and than use the additional memory for the system. This can improve performance so much ....
Is this possible? I'm a dev, but not on this kind of platform . I know shell scripting, Unix, C so I can help if needed, but don't know how to approach this thing.
Thx.
mr.tenuki said:
Originally, a2sd was developed to allow installation of many apps on G1 as G1 has limited memory. The MT3G has more internal memory so it does not need a2sd.
My question is if we can enable a2sd on a MT3G and than use the additional memory for the system. This can improve performance so much ....
Is this possible? I'm a dev, but not on this kind of platform . I know shell scripting, Unix, C so I can help if needed, but don't know how to approach this thing.
Thx.
Click to expand...
Click to collapse
It depends. Now if you have a 32a board, this is pointless. Unless you have 300+apps installed it will not hurt performance.
I sugest App killer to kill off unused apps that never shut down, it helps so much/
Me really dont need Apsd for mytouch, especially the new 32a boards. Running from the sd card slows everythign down. To improve your performance..
1. Get CPU overclosk from market, set lowest to 386, high to 528 screen on, screen off 256/256.
2. Download swapper, set to size of yoru swap partition etc...
3. Get any free app killer ( ifully suggest Anvanced task killer) and every hour or so, go in and ignore what u use all the time, and kill everything else.
Also, get Cachemate from market or Clean up. this clears out all the garbage.
Doing this, on a good day, my battery lasts 17 hours with data going. and My Live wallpapers never lag
Hi,
Thanks - I already have all that set up. I was thinking on a MOD that will allow improvement of performance in a different way.
My Idea is to actually use the memory that becomes available under /data as we move the app to SD to be used by /system partition. Maybe we can also do a "reverse RAM hack" and increase the 3D RAM.
Again, as I'm not very familiar with the Linux system I don't know how exactly this should be done, or if it can be done at all.
Thanks for the reply though
storage memory in the phone is different then addressable ram.. therefore what your saying is not possible...if you really want something like this set up a swap partition on your sd card.
also task killers are not needed for android... its been well documented here and on other forums as android handles processes much differently than your standard windows box (so no need to have the mindset that background apps are slowing down your system). android itself does an excellent job of managing memory and kills tasks itself when more mem is needed. i used to run ATK myself, and found after removing it my phone actually ran better than killing processes all the time.
your likely just having a placebo affect if you think it speeds up your phone.. however killing process can increase battery life.. albeit only slightly...try it yourself and you will see what im talking about..
regarding task killers, just google it and you will see what im saying...
edit: most roms have cpu scaling in them, if you want an app i find set cpu to be the best, followed by overclock widget...
edit2: forgot to mention autostarts . a great program to edit which programs start up upon boot .. if your still worried about having things running in the background...
I was trying to get a swapfile on /Data (being a lot faster than sdcard, probably), but It didn't work :/

[CompCache] Setting compcache to full RAM size

I've always run compcache on my ROMs when possible and I recently had the idea that setting the full amount of RAM to compcache could be an interesting test. The theory being that it may be slightly slower overall to have ramzswap compressing pages, but minfree would have heaps of memory to play with and apps would never quit, so multitasking would be faster as no apps are writing out to /data and then having to relaunch when I switch to them again.
I've set compcache with the init script like so
Code:
insmod /system/lib/compcache/ramzswap.ko;
rzscontrol /dev/block/ramzswap0 -i -d 98304;
busybox swapon /dev/block/ramzswap0;
And Linux reports the swap is working
Code:
# free
total used free shared buffers
Mem: 107332 105972 1360 0 8
Swap: 98296 48940 49356
Total: 205628 154912 50716
But no matter what I do, even if I launch a heap of apps, I can never get swap usage above the ~48Mb RAM seen here.
Furthermore, apps like Auto Killer and Free Memory only report I have 102Mb RAM total.
What's going on here? Why does Android think it only has 100Mb when free is reporting near on 200Mb total? Why does compcache only fill up halfway and no more? Does this mean that ~48Mb RAM is the "sweet spot" for compcache and any more is pointless?
The phone does feel faster when switching between apps but I could just be imagining it. Out of interest this is a 32B Magic running Dwang 1.17.1, which is basically just Donut AOSP with a faster framework and kernel.
Any ideas/help/suggestions would be appreciated?
Swap is never, ever, regarded by the system as real memory, hence why the system won't report it, since you really only have ~100 mb physical ram.
As to why you're only using 48, I believe that 48 is 1/2 96, so it probably means pages are being compressed 2:1, so the full memory is being compressed and dumped into RAM, and it only occupies 48 MB, leaving you 48 free for other processes.
Again, remember comcapche is swap, not real memory.
jubeh said:
Swap is never, ever, regarded by the system as real memory, hence why the system won't report it, since you really only have ~100 mb physical ram.
As to why you're only using 48, I believe that 48 is 1/2 96, so it probably means pages are being compressed 2:1, so the full memory is being compressed and dumped into RAM, and it only occupies 48 MB, leaving you 48 free for other processes.
Again, remember comcapche is swap, not real memory.
Click to expand...
Click to collapse
I don't think that that analysis is quite right....
First off, you MUST maintain SOME amount of real memory available... otherwise it'll crash in a spectacular way. I believe that the linux kernel itself may have a safety feature that maintains a certain minimum amount of physical ram available. There ARE certain things that the linux kernel will not be willing to swap, such as ITSELF.
Just imagine what would happen if the kernel swapped itself..... any attempt to do this wouldn't end well. Especially if it tried to swap its ENTIRE self since the kernel MUST be in memory in order for it to run.
There is also the swappiness setting... it controls the system's tendency to swap.
And finally, there is the possibility that you may simply not be starting enough processes to consume the full memory!
So imagine this; you have your compcache set for a certain size. It grows to that size and then finally, the kernel says "screw you, you can't have any more memory!" blows an error back to compcache, which complains back to the kernel "sorry, swap is screwed." Yep.... the kernel tells compcache which tells the kernel rather than the kernel just knowing.
You definitely don't want this happening.
Note: I can forsee some serious stability problems that this could result in related to the low memory process killer. Specifically, your compcache grows to its maximum allowed size, you start an application, the low memory process killer figures that you've got plenty of memory available, doesn't kill anything off, tries to start some application, crashes spectacularly when the kernel complains back that it doesn't have any memory. I don't know if this would happen with a stock low memory process killer, but definitely would with the swap hacks added....
lbcoder said:
Note: I can forsee some serious stability problems that this could result in related to the low memory process killer. Specifically, your compcache grows to its maximum allowed size, you start an application, the low memory process killer figures that you've got plenty of memory available, doesn't kill anything off, tries to start some application, crashes spectacularly when the kernel complains back that it doesn't have any memory. I don't know if this would happen with a stock low memory process killer, but definitely would with the swap hacks added....
Click to expand...
Click to collapse
92 MB of compcache doesn't really need 92MB of compcache... that's the point of being compcache.
Compcache file in RAM grows when cache gets stuffed inside compcache.
Setting a low swappiness will cause compcache to just swap what's needed.
And even with full compcache, in the end you end up having around 140 mb (or so) free ram. 92mb of compcache that takes like 50mb and 42 extra mb of normal ram.
I think this idea is great (I was just too lazy to try yet...). Instead of dalvik vm having to free up memory it can stuff some more mb in compcache. should be faster.
I didn't really think my post through... but I hope some of you understood some of the things I wanted to communicate xD
domenukk said:
92 MB of compcache doesn't really need 92MB of compcache... that's the point of being compcache.
Compcache file in RAM grows when cache gets stuffed inside compcache.
Setting a low swappiness will cause compcache to just swap what's needed.
And even with full compcache, in the end you end up having around 140 mb (or so) free ram. 92mb of compcache that takes like 50mb and 42 extra mb of normal ram.
I think this idea is great (I was just too lazy to try yet...). Instead of dalvik vm having to free up memory it can stuff some more mb in compcache. should be faster.
I didn't really think my post through... but I hope some of you understood some of the things I wanted to communicate xD
Click to expand...
Click to collapse
Interesting in theory, but if you actually read what I said, you would note that this is entirely IMPOSSIBLE and would crash spectacularly if not for and in some cases in SPITE of certain safety features built into the kernel.
Note: If you have 70 MB worth of data that CAN'T be swapped, that leaves 20 MB ***PEAK*** available to compcache.
It is neither fair nor sensible to think of all memory as being equal. Running processes ***MUST*** have REAL MEMORY.
A little off-topic, but this discussion (the possibility of REAL "compressed" memory) sparked a thought/question:
Would/could KSM* bring any benefit to Android? (Not sure if the KSM module can even compile/work on ARM)
I know KSM is normally used for detecting and sharing duplicate pages among KVM guests, but I wonder how many pages in a typical running Android installation are duplicated, and thus candidates for sharing/de-duplication.
*I can't posts links yet, so those that don't know what KSM is, will just have to google for it.
lbcoder said:
There ARE certain things that the linux kernel will not be willing to swap, such as ITSELF.
Click to expand...
Click to collapse
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
lbcoder said:
It is neither fair nor sensible to think of all memory as being equal. Running processes ***MUST*** have REAL MEMORY.
Click to expand...
Click to collapse
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
brainbone said:
*I can't posts links yet, so those that don't know what KSM is, will just have to google for it.
Click to expand...
Click to collapse
I do not know either, but here are some links people may wish to look at
http://fedoraproject.org/wiki/Features/KSM
http://lwn.net/Articles/306704/
http://lwn.net/Articles/330589/
http://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvm
Ok I am not at all experienced in this area but this is just a suggestion. You say that you can only get 48mb of swap to be compressed at a time. If those 48mb were uncompressed, then that would occupy the 98mb you alloted to it. If you set the cc at say 128mb, then in (my) theory up to 64mb of it the actual ram would be used. I don't know how much sense I'm making but not sure exactly how to explain it. If you don't get it I'll try explaining my logic a little more in depth.
mejorguille said:
If you set the cc at say 128mb, then in (my) theory up to 64mb of it the actual ram would be used.
Click to expand...
Click to collapse
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Super Jamie said:
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Click to expand...
Click to collapse
I rock=p
So what's your performance like, compared to say 32mb cc or no cc at all?
It's different but I like it.
There is sometimes a slight (<2 second) pause when launching a new app (I assume this is compcache compressing old pages to swap to make way for the new app) however once the app is up and running, it almost never "exits" so switching between previously-launched apps is noticeably faster than without compcache. I run HelixLauncher Donut and it's never closed and re-launched while I've been trying this, however it did sometimes with 32Mb cc and quite often without cc at all.
I had 5 day uptime last week with 96Mb compcache (rebooted whilst testing another app for a friend) so I don't think stability is an issue. The CM wiki indicates performance with cc is better upon boot then gradually declines, even if that is the case, rebooting my phone once a week is no big issue.
Unless I run into any major issues, I'll be keeping my phone with large compcache
Super Jamie said:
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
I do not know either, but here are some links people may wish to look at
http://fedoraproject.org/wiki/Features/KSM
http://lwn.net/Articles/306704/
http://lwn.net/Articles/330589/
http://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvm
Click to expand...
Click to collapse
ksm sound cool. As every app runs inside dalvik vm. Not sure though... somebody should ask cyanogen
I am happy thatlarge compcache works out so well for you.
BTW doesn't cyanogenmod 5 count the whole swap as real memory since test4 or so?
Oh and overclocking ondemand to as high as possible will speed up app opening and switching a lot while on compcache
domenukk said:
doesn't cyanogenmod 5 count the whole swap as real memory since test4 or so?
Click to expand...
Click to collapse
It's counted as available "swap" memory, but not "real" ram. Pages stored in "real" ram (memory that the cpu can directly execute code in) still need to be freed up (moved to swap) before previously swapped pages can be moved back in to "real" memory to be executed.
domenukk said:
ksm sound cool.
Click to expand...
Click to collapse
The beauty of KSM is that it does no "swapping". It simply combines 4KB pages that are identical -- so instead of two identical 4KB pages using 8KB of ram, they only take 4KB. The code is executed in place.
KSM would, however, still require swap. If at any time a virtual shared 4KB page is written to, it needs to be copied to a free page to avoid corrupting the virtual page it was a duplicate of before the write. Swap is needed to ensure that there will always be enough available free pages when this happens.
domenukk said:
As every app runs inside dalvik vm.
Click to expand...
Click to collapse
KSM is not dependent on a VM, but the existence of VMs (java or otherwise) increases the likelihood of duplicate pages.
domenukk said:
Not sure though... somebody should ask cyanogen
Click to expand...
Click to collapse
I'd certainly be interested in cyanogen's thoughts on this, but I'm sure there are others that would be able to chime in as well.
Relevant excerpt from kernel.org/doc/ols/2009/ols2009-pages-19-28.pdf
KSM and embedded
KSM is suitable to be run on embedded systems too; the important thing is not to register in KSM regions that won’t likely have equal pages. For each virtual page scanned, KSM has to allocate some rmap_item and tree_item, so while these allocations are fairly small, they can be noticeable if lots of virtual areas are scanned for no good.
Furthermore, these KSM internal rmap/tree data structures are not allocated in high memory. To avoid early out of memory conditions, it is especially important to limit the amount of lowmem allocated on highmem 32bit systems that might have more than 4GB of memory, but these shouldn’t fit in the embedded category in the first place.
Click to expand...
Click to collapse
Super Jamie said:
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
Click to expand...
Click to collapse
Memory reporting is a tricky thing.
But in general, when RAM is allocated to HARDWARE, it is NOT REPORTED.
The chunk of the 192 that is not reported is assigned PRIMARILY to the RADIO. Another chunk is assigned to the GPU. Still more is assigned to the AUDIO HARDWARE.
The part used by the kernel itself IS reported. The most trivial empirical evidence to prove this to you is that when you change KERNELS, it doesn't affect the total system memory, despite your KNOWING that different kernels use different amounts of RAM.
Another bit of empirical proof is that activating COMPCACHE does not reduce the total physical ram reported. And yes, COMPCACHE is part of the kernel...
Now here's another concept of crash and burn: IF everything in memory could be cached in compcache, then what would stop compcache from caching compcache in a horrible infinite memory sucking loop? That would be very very bad, LOL.
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Click to expand...
Click to collapse
NOW you're getting the idea! Running processes, kernel, etc., all need physical RAM (though actually those processes you mention most definitely CAN be swapped...), and therefore you CAN'T make the ENTIRE RAM into compcache!
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
Click to expand...
Click to collapse
Just beware of possible crash-and-burn
Super Jamie said:
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Click to expand...
Click to collapse
That doesn't actually follow from what you've posted here.
What follows is that 105956-(65520/2)=73196 of what occupies your memory can't be swapped (kernel, running processes, etc.).
lbcoder said:
What follows is that 105956-(65520/2)=73196 of what occupies your memory can't be swapped (kernel, running processes, etc.).
Click to expand...
Click to collapse
Do you know why swap constantly "settles" at almost exactly half usage regardless of what size compcache I set?
For example, I set 64Mb compcache yesterday and rebooted. Just using my phone normally (browser, genie widget, music) I have this:
Code:
total used free shared buffers
Swap: 63992 32096 31896
Does this mean I am effectively reducing the amount of RAM the phone has for the kernel, "foreground app", "visible app" and "secondary servers" (to use the minfree terms), whilst at the same time allowing more "hidden app" and lower processes to swap out instead of terminating gracefully?
This disturbs me
-------------------------------------
Sent via the XDA Tapatalk App
brainbone said:
I'd certainly be interested in cyanogen's thoughts on this, but I'm sure there are others that would be able to chime in as well.
Click to expand...
Click to collapse
He doesn't know much about it, yet. But he seems inerested.
Attached a short conversation over #twitter
# Dominik domenuk
@cyanogen Is ksm any good 2 save RAM? probably not - you would have already done it http://lwn.net/Articles/329123/
# Steve Kondik cyanogen
@domenuk I don't know too much about it, I think its meant for sharing between distinct virtual machines
@domenuk it could have a lot of potential though
# Dominik domenuk
@cyanogen basically yes. But he states its also for normal apps. I have no idea to what extend android apps have similar memory, though...
# Steve Kondik cyanogen
@domenuk a lot, Android is all about IPC and shared memory. I wouldn't be surprised if the Dalvik people are thinking about it.
Click to expand...
Click to collapse
Here is a way to make Android use more than 50 percent of a swap partition. I am not sure how it will act with compcache... Should be the same... Run the following commands from a terminal or add them following to your userinit.sh file:
Code:
su
echo 80 > /proc/sys/vm/swappiness
echo 150 > /proc/sys/vm/vfs_cache_pressure
!!WARNING!! - Messing with VM settings can cause data loss and system instability... Not liable for damages...
Using the above the "free" output is:
Code:
total used free shared buffers
Mem: 97708 95168 2540 0 356
Swap: 125296 88756 36540
Total: 223004 183924 39080
While we are at it... If anyone is willing... they can try this as well:
echo 1 > /proc/sys/vm/oom_kill_allocating_task
Reference : Article to Linux Insight
Been having pretty good results with it...
Here is a link to the rest of the vm settings...
Linux Insight article listing vm settings
L8r

Best optimization hack in my experience: RAMEXPANDER

TL;DR Ramexpander set at 4gb swap file makes all the difference for this tablet
A little background: I've been modifying my phones since the galaxy nexus. I've tried greenify, amplify, debloating, kernels, overclocking, cleaning, l-speed, etc. I like to run a lot of apps, and all of my phones and devices, including the Nexus 6p (until the Pixel XL) lagged. RamExpander has been the solution every time, and the fire hd is no different. This one: https://play.google.com/store/apps/details?id=com.swapit.expander.de&hl=en .
Use the free version here to check if your device is compatible: https://play.google.com/store/apps/details?id=com.roehsoft.meminfo&hl=en but I know a rooted 2017 Hd 10 running 5.6 is compatible.
Maybe your device runs perfectly already and/or you're using less apps. That's great! But I have seen a few threads about trying to optimize performance. IF your device lags, this app will make an immediate night and day difference.
I'll give it a try
I have L Speed and Greenify installed on all of my rooted Android devices. Could you please explain to us how RAMEXPANDER is better than L Speed/Greenify? I'm curious. I'll do anything to optimize these Fire HDs even more. I rooted them and installed Google everything on them so my parents don't have to deal with the Fire OS.
Is Ram Expander really worth $10? I wanted to try it and found an APK. The damned thing was contaminated with neverending ads appearing every 10 seconds... I had to uninstall and run Malwarebytes to get the tablet working fine again. I assume the "real" paid version has no crappy ads?
---------- Post added at 01:09 AM ---------- Previous post was at 01:08 AM ----------
bakshi said:
I have L Speed and Greenify installed on all of my rooted Android devices. Could you please explain to us how RAMEXPANDER is better than L Speed/Greenify? I'm curious. I'll do anything to optimize these Fire HDs even more. I rooted them and installed Google everything on them so my parents don't have to deal with the Fire OS.
Click to expand...
Click to collapse
I know Greenify already and use it on my tablets and cell phones. But it's the 1st time ever I hear about L Speed. Is it complicated to set up?
The 2GB memory is pretty limited, and disabling some Amazon services and avoiding apps that remain persistent in memory is highly recommended. I installed the official Google app to get Google Assistant, but found that it used too much ram. I recommended installing system monitor and monitoring the active processes, sorted by ram usage, to identify bloated user apps.
bakshi said:
I have L Speed and Greenify installed on all of my rooted Android devices. Could you please explain to us how RAMEXPANDER is better than L Speed/Greenify? I'm curious. I'll do anything to optimize these Fire HDs even more. I rooted them and installed Google everything on them so my parents don't have to deal with the Fire OS.
Click to expand...
Click to collapse
so what ram expander does is it's just a super easy way to setup a swap file (space on the internal sd card that will be used as RAM). Why is it better than all the other stuff I've tried? It's empirical, not logical. That is to say, every phone that's lagged, if RAMEXPANDER is compatible, I've installed and it's made a huge difference in performance, every single time. I've messed around with a lot of optimization tools beforehand and results have been mixed. I can improve battery life usually, but the phone will still lag, with those tools and with all the apps i run. Also, each tool is just more strain on the system.
metaleloi666 said:
Is Ram Expander really worth $10? I wanted to try it and found an APK. The damned thing was contaminated with neverending ads appearing every 10 seconds... I had to uninstall and run Malwarebytes to get the tablet working fine again. I assume the "real" paid version has no crappy ads?
---------- Post added at 01:09 AM ---------- Previous post was at 01:08 AM ----------
I know Greenify already and use it on my tablets and cell phones. But it's the 1st time ever I hear about L Speed. Is it complicated to set up?
Click to expand...
Click to collapse
I've never seen an add in the app. You got a bad APK.
An alternative, I've found, though less intuitive is an app called apps2sd. https://play.google.com/store/apps/details?id=in.co.pricealert.apps2sd&hl=en
It's a little less intuitive, but basically when you open the app, you get a bunch of tools to choose from. If you choose the SWAP menu, you can create a SWAP Partition on the /data partition. 4gb has been working amazingly for me. Then go to settings and check the "apply swap on boot" (after you test it for a while, and you're happy and everything's stable).
L-speed has a lot of options. It's got a few profiles, but I'm not sure that they actually work. With some messing around you can get a little improvement here and there (or maybe it's placebo). Sometimes an update of L-speed will bootloop your device, but I only use it on devices I have an nandroid ready to go on.
SWAP, through ram expander or apps2sd, makes a night and day difference compared to any other tool I've tried.
Does Ram Expander starts automatically at each reboot or it has to be started manually each time?
mistermojorizin said:
so what ram expander does is it's just a super easy way to setup a swap file (space on the internal sd card that will be used as RAM). Why is it better than all the other stuff I've tried? It's empirical, not logical. That is to say, every phone that's lagged, if RAMEXPANDER is compatible, I've installed and it's made a huge difference in performance, every single time. I've messed around with a lot of optimization tools beforehand and results have been mixed. I can improve battery life usually, but the phone will still lag, with those tools and with all the apps i run. Also, each tool is just more strain on the system.
I've never seen an add in the app. You got a bad APK.
An alternative, I've found, though less intuitive is an app called apps2sd. https://play.google.com/store/apps/details?id=in.co.pricealert.apps2sd&hl=en
It's a little less intuitive, but basically when you open the app, you get a bunch of tools to choose from. If you choose the SWAP menu, you can create a SWAP Partition on the /data partition. 4gb has been working amazingly for me. Then go to settings and check the "apply swap on boot" (after you test it for a while, and you're happy and everything's stable).
L-speed has a lot of options. It's got a few profiles, but I'm not sure that they actually work. With some messing around you can get a little improvement here and there (or maybe it's placebo). Sometimes an update of L-speed will bootloop your device, but I only use it on devices I have an nandroid ready to go on.
SWAP, through ram expander or apps2sd, makes a night and day difference compared to any other tool I've tried.
Click to expand...
Click to collapse
Thanks for this. Just did this with app2sd and working great!
metaleloi666 said:
Does Ram Expander starts automatically at each reboot or it has to be started manually each time?
Click to expand...
Click to collapse
It has an auto start feature
metaleloi666 said:
Is Ram Expander really worth $10? I wanted to try it and found an APK. The damned thing was contaminated with neverending ads appearing every 10 seconds... I had to uninstall and run Malwarebytes to get the tablet working fine again. I assume the "real" paid version has no crappy ads?
Here is a link for the premium: https://uplod.cc/4ogqacud4av9
If that doesn't work, check this link out: https://apk4free.net/roehsoft-ram-expander/
Click to expand...
Click to collapse
I keep trying to install this (the Google Play store version of ROEHSOFT RAM Expander) on a Fire HD10 with root via Kingoroot. I'm trying to install the swap disk on the SD card, and I'm getting an error message:
You have a Limited Kernel
Kernel Swapspace Limit detected! please reduce the Swapfile Size lower 1GB! and try again!
This happens no matter what size I pick for the swap file on the SD card.
If I try to use the same company's "test" app (MemoryInfo-SwapCheck), I get this error message:
Path Error
This Path is not usable for Swap!
I can verify that both apps are successfully creating the swap file on the SD card (swapfile.swp or swaptestf.swp, depending on which app I'm using).
I've tried both systems 5.5.0.0 and 5.6.0.1 and I get the same error message on either. I've tried installing it on a completely fresh install of both, with only Kingoroot, SuperSU, Google Play, and RAM Expander installed (in that order). I've also tried swapping out SD cards, and get the same error on both.
This software does work properly if I install the swap file on internal memory, but I'd prefer not to do that, since I can't replace the internal memory if I wear it out.
The weird thing is, I could swear it was working properly before (a couple of weeks ago), but nothing is getting this to work now. It's possible I was mistaken and had accidentally chosen the internal memory, but I don't think so.
Anyone have any clue about what's going on?
GamerOfRassilon said:
I keep trying to install this (the Google Play store version of ROEHSOFT RAM Expander) on a Fire HD10 with root via Kingoroot. I'm trying to install the swap disk on the SD card, and I'm getting an error message...
Click to expand...
Click to collapse
To respond to myself (in case anyone else has this problem in the future):
For some reason, this software doesn't work if you set the path to /storage/sdcard1 (It will create the swap file, but then it gives the error message I described).
Instead, you have to use:
/mnt/media_rw/sdcard1
Then it works totally fine.
Also, if it's useful (and saves anyone else time), here are the values that each option of this software generates on the HD10:
multitasking
SwpFile = 3000MB
Swappiness = 100
MinFreeKB = 54MB
DriveCache(KB) = 4096
balanced
SwpFile = 3000MB
Swappiness = 100
MinFreeKB = 62MB
DriveCache(KB) = 8192
gamers
SwpFile = 3000MB
Swappiness = 100
MinFreeKB = 62MB
DriveCache(KB) = 16384
net gamers
SwpFile = 3000MB
Swappiness = 100
MinFreeKB = 4MB
DriveCache(KB) = 1024
I have no idea what those options mean or do, but I went with "balanced" (since it seemed pretty middle of the road) but with SwpFile set to 4000MB instead of 3000MB.
Ramexpander etc.
I've paid for and been using RAMExpander for awhile now. It's a good app, and worth the money. That being said, App2SD is also an incredibly useful app, Pro or no. L-Speed is great as well. One thing to note, from what I've researched, editing your zram is also helpful as it compresses items in memory to free up space, and it is prioritized over Swap. Using the two in conjunction (having a zram file (250-500 MB seems to do the trick but you could probably go lower) and a decent sized swap file(mine is 8GB but I suspect this is massive overkill and 4 would work)) has left me with little to no lag, especially when paired with L-Speed's other exceptional tweaks. Jade Empire and Kotor run with 0 lag at top graphical settings.
Hope this helped clear up any questions.
Edit: If you use App2SD's partition manager you can set yourself up with a partition dedicated exclusively to Swap, then in Ramexpander change swap location to this partition in the settings. Ramexpander tops you out at 4GB, doing this is a good way to increase that threshold.
mistermojorizin said:
so what ram expander does is it's just a super easy way to setup a swap file (space on the internal sd card that will be used as RAM). Why is it better than all the other stuff I've tried? It's empirical, not logical. That is to say, every phone that's lagged, if RAMEXPANDER is compatible, I've installed and it's made a huge difference in performance, every single time. I've messed around with a lot of optimization tools beforehand and results have been mixed. I can improve battery life usually, but the phone will still lag, with those tools and with all the apps i run. Also, each tool is just more strain on the system.
I've never seen an add in the app. You got a bad APK.
An alternative, I've found, though less intuitive is an app called apps2sd. https://play.google.com/store/apps/details?id=in.co.pricealert.apps2sd&hl=en
It's a little less intuitive, but basically when you open the app, you get a bunch of tools to choose from. If you choose the SWAP menu, you can create a SWAP Partition on the /data partition. 4gb has been working amazingly for me. Then go to settings and check the "apply swap on boot" (after you test it for a while, and you're happy and everything's stable).
L-speed has a lot of options. It's got a few profiles, but I'm not sure that they actually work. With some messing around you can get a little improvement here and there (or maybe it's placebo). Sometimes an update of L-speed will bootloop your device, but I only use it on devices I have an nandroid ready to go on.
SWAP, through ram expander or apps2sd, makes a night and day difference compared to any other tool I've tried.
Click to expand...
Click to collapse
Blaiser47 said:
Thanks for this. Just did this with app2sd and working great!
Click to expand...
Click to collapse
How did you set it up?
I swaped it on Sd card on my j7 & it became to freeze & became super slow...
What about using BK Disabler?
ThisCrimsonDiscordia said:
I've paid for and been using RAMExpander for awhile now. It's a good app, and worth the money. That being said, App2SD is also an incredibly useful app, Pro or no. L-Speed is great as well. One thing to note, from what I've researched, editing your zram is also helpful as it compresses items in memory to free up space, and it is prioritized over Swap. Using the two in conjunction (having a zram file (250-500 MB seems to do the trick but you could probably go lower) and a decent sized swap file(mine is 8GB but I suspect this is massive overkill and 4 would work)) has left me with little to no lag, especially when paired with L-Speed's other exceptional tweaks. Jade Empire and Kotor run with 0 lag at top graphical settings.
Hope this helped clear up any questions.
Edit: If you use App2SD's partition manager you can set yourself up with a partition dedicated exclusively to Swap, then in Ramexpander change swap location to this partition in the settings. Ramexpander tops you out at 4GB, doing this is a good way to increase that threshold.
Click to expand...
Click to collapse
Just out of curiosity, what are your L Speed settings?
I went with App2SD and L-Speed after reading this thread, and wow, it's practically a different experience, a different tablet. If you aren't doing something similar you're purposefully using a tablet that is gimped.
Here are the settings I went with:
App2SD swap is set to 4GB and placed in /data.
L-Speed has everything turned on as it would when first installed.
RAM Manager is set to balanced, seems like more than enough and I don't want to be plugged in frequently.
zRAM Optimization is set to on.
I then went back to swap settings and set the zRAM to priority 0 and /data set to 1.
Turned improved scrolling on.
Everything else was left as is, for now.
I can't believe this is the same tablet I was using a week ago.
No need for Greenify with this combination.
What size should i set the swap partition to?
Since the swap will be on the sd card, should I go with the Samsung MicroSDXC EVO Plus which has 100/60 read/write rates or the Samsung PRO Endurance which has better reliability (designed for continuous writes) in the long run but only 100/30 read/write?
lanbladez said:
What size should i set the swap partition to?
Since the swap will be on the sd card, should I go with the Samsung MicroSDXC EVO Plus which has 100/60 read/write rates or the Samsung PRO Endurance which has better reliability (designed for continuous writes) in the long run but only 100/30 read/write?
Click to expand...
Click to collapse
You could probably get away with 2GB, honestly. In which case, I'd really suggest putting it on internal in /data.
Just one less I/O delay (even if seemingly trivial, will cause lag) to deal with.
If you're going with putting the swap on an SD rather than internal, definitely the fastest SD you can use. :fingers-crossed:
If you must put it on the SD, at the least create a zram "swap" on internal, it only has to be ~150-300MB.

Categories

Resources