maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   additional swap file (https://talk.maemo.org/showthread.php?t=86752)

wook_sf 2012-09-10 10:12

additional swap file
 
i believe that linux should have some swap, maybe not 2GB (i use one GB) but, it should have some space for this.
especially, it's not big deal if mass storage is in some other file system than FAT.
related to:
https://www.linux.com/news/software/...ux-swap-space/
i've made some little tests and i think so far there's lot of ways to speed up phone little bit and this is one of first steps.

this is only for super advanced users and no one is responsible if you damage anything with this, it's also only for those who don't connect phone to mass storage very often.


it's important to note that swap is not replacement for RAM and it will not make "visible" changes to your device (like more ram....)
so, here we go:
need: sudo package and probably open mode kernel?

Code:

$ sudo su
# dd if=/dev/zero of=/home/user/MyDocs/.swap0 bs=1024 count=2097152
# mkswap /home/user/MyDocs/.swap0
# swapon /home/user/MyDocs/.swap0

Code:

free
Code:

/etc/init/apps/swapp-add.conf
Code:

description "additional swap file for harmattan"
author "wook dot ba at gmail dot com"
stop on stopping xsession
console none
respawn
nice 2

env DISPLAY=:0.0

pre-start script
    swapon /home/user/MyDocs/.swap0
end script

download swap-add.conf

little automatization:

scripts for "quick" add/rem /home/user/MyDocs/.swap0:
copy them to /sbin/ or /bin/ or /usr/bin and do:
Code:

#chmod +x setswap0
#chmod +x rmswap0

download setswap0
download rmswap0

###############

additional notes:
line dd if=/dev/zero of=/home/user/MyDocs/.swap0 bs=1024 count=2097152 means: fill /home/user/MyDocs/.swap0 with zeros in block size 1024 for 1024*2048 so maybe you will want to replace it with 1024*1024 (1048576)

to view swap files use:
# cat /proc/swaps
to view memory:
$ free

only for advanced users!!!

thedead1440 2012-09-10 10:27

Re: additional swap file
 
works well here ;)

Just hope AMD comes and tries this out too... That would make it so fun...Haha :D

wook_sf 2012-09-10 10:30

Re: additional swap file
 
thanks for report :P

hahahahaha :D well, we'll send him to Arie :P but, you should explain procedure to him ;) :D

rainisto 2012-09-10 19:37

Re: additional swap file
 
Running swap on flash of course kills the flash memory at some point. Just a word of caution.

But having said that, I have always wondered why nobody has enabled the near 500MB extra mtd block device that is unused on the Harmattan devices. ;-)

I give this as a hint: /etc/init/enable-swap.conf (with couple changes (remember to resign hashlist or you malf your device) you can gain 256MB more free ram (when disabling ramz) and gain almost 500MB swap). And it doesn't mess your mass storage size.

wook_sf 2012-09-10 19:57

Re: additional swap file
 
Quote:

Originally Posted by rainisto (Post 1264402)
Running swap on flash of course kills the flash memory at some point. Just a word of caution.

But having said that, I have always wondered why nobody has enabled the near 500MB extra mtd block device that is unused on the Harmattan devices. ;-)

I give this as a hint: /etc/init/enable-swap.conf (with couple changes (remember to resign hashlist or you malf your device) you can gain 256MB more free ram (when disabling ramz) and gain almost 500MB swap). And it doesn't mess your mass storage size.

well, eventually it will be dead anyway :D it can't last for ever though, but that's really good idea and i'll give it a try, though i am very newbie into nux under core and i was always wondering why there's no much tweaks/mods....either everyone is happy with phones, or ...:D
thanks for this hint :)

thedead1440 2012-09-14 16:40

Re: additional swap file
 
My output of free:

Code:

RM696-21-3_PR_005:~# free
                total              used            free      shared      buffers
Mem:      1008108      908720        99388            0        44816
-/+ buffers:            863904      144204
Swap:      2359280      12264          2347016


wook_sf 2012-09-14 16:45

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1266413)
My output of free:

Code:

RM696-21-3_PR_005:~# free
                total              used            free      shared      buffers
Mem:      1008108      908720        99388            0        44816
-/+ buffers:            863904      144204
Swap:      2359280      12264          2347016


huh, it looks to me like DDoS from somewhere :D
2347016 in swap....i am wondering what's there :S :D

thedead1440 2012-09-14 16:45

Re: additional swap file
 
oh wook all dead parrots in there :p :p

wook_sf 2012-09-14 16:46

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1266418)
oh wook all dead parrots in there :p :p

ahahahaha, kill em all :D

thedead1440 2012-09-15 13:06

Re: additional swap file
 
Quote:

Originally Posted by rainisto (Post 1264402)
Running swap on flash of course kills the flash memory at some point. Just a word of caution.

But having said that, I have always wondered why nobody has enabled the near 500MB extra mtd block device that is unused on the Harmattan devices. ;-)

I give this as a hint: /etc/init/enable-swap.conf (with couple changes (remember to resign hashlist or you malf your device) you can gain 256MB more free ram (when disabling ramz) and gain almost 500MB swap). And it doesn't mess your mass storage size.


I guess you mean mtd6 block?

rainisto 2012-09-15 20:07

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1266847)
I guess you mean mtd6 block?

for the love of god, NO, and its not mtd5 either, if you would have tried that then you would have permanently bricked your device in a state that even re-flash couldn't rescue.

So maybe I'll give a bit better hints before people start bricking their devices, its mtd4("var"), so the patch would look like this:

http://pastebin.com/raw.php?i=8rS81vUX

(And remember to resign refhashlist with right sha1, or you malf your device)

wook_sf 2012-09-15 20:12

Re: additional swap file
 
Quote:

Originally Posted by rainisto (Post 1267069)
for the love of god, NO, and its not mtd5 either, if you would have tried that then you would have permanently bricked your device in a state that even re-flash couldn't rescue.

So maybe I'll give a bit better hints before people start bricking their devices, its mtd4("var"), so the patch would look like this:

http://pastebin.com/raw.php?i=8rS81vUX

(And remember to resign refhashlist with right sha1, or you malf your device)

wait a second, it will be
Code:

ramz=64 * 1024
instead of 256 * 1024...though or?
anyhow, i still do think that it would be very nice to have rescueOS somewhere :D

death_jax 2012-09-22 13:13

Re: additional swap file
 
In the first post is written "this is only for super advanced users and no one is responsible if you damage anything with this, it's also only for those who don't connect phone to mass storage very often."; I think this happens because the swap was created in the MyDocs folder.. But is it possible to create the swap in the /home/user folder? I know that who has nitdroid has only about 800MB of free space (like me) but is an option, and who hasn't nitdroid has more free space to use.

thedead1440 2012-09-22 13:16

Re: additional swap file
 
If you create your swap in userfs partition you are going to straight away limit the space for application data hence do it in mmc partition...

kanser 2012-09-22 15:02

Re: additional swap file
 
Just a Noob question:
Isnt the fasterN9 app (which works very good for me) disabling the swap funcion of the n9 (dont realy know that exatly swap is). So if disabling swap maces the n9 better -> wouldnt a additional swap mace it worse?

Im sure that i have a logic mistake so pls help me to find it.

thedead1440 2012-09-22 15:23

Re: additional swap file
 
I don't remember reading about fastern9 disabling swap...

Anyway by default swap is only at 256mb which is not that much...What wook has done here is create a swap of 2x of RAM so it makes things snappier and makes swap more effective...

ibrakalifa 2012-09-22 15:34

Re: additional swap file
 
Noob question, how to reset the swapram? Dropcache cant do that thing

death_jax 2012-09-22 15:40

Re: additional swap file
 
Just out of curiosity, what is the /home/user/.signon/signonfs-mnt partition, (it's about 6.8MB)?

traysh 2012-09-22 15:41

Re: additional swap file
 
Quote:

Originally Posted by kanser (Post 1270637)
Just a Noob question:
Isnt the fasterN9 app (which works very good for me) disabling the swap funcion of the n9 (dont realy know that exatly swap is). So if disabling swap maces the n9 better -> wouldnt a additional swap mace it worse?

Im sure that i have a logic mistake so pls help me to find it.

FasterN9 does not touch swap.

By the way, N900 has swap in a flash device enabled by default and I don't think it caused problems for anyone.
So the idea here is to use both the ram swap and the flash swap, right? Does it make the phone really faster?

traysh 2012-09-22 15:46

Re: additional swap file
 
Quote:

Originally Posted by ibrakalifa (Post 1270648)
Noob question, how to reset the swapram? Dropcache cant do that thing

Dropcache erases the cache and there's no cache in swap (in ramswap or flash), so not possible to erase it.

traysh 2012-09-22 15:48

Re: additional swap file
 
Quote:

Originally Posted by death_jax (Post 1270652)
Just out of curiosity, what is the /home/user/.signon/signonfs-mnt partition, (it's about 6.8MB)?

It's an encrypted partition with data required to login on your accounts. Do not touch it.

ibrakalifa 2012-09-22 15:49

Re: additional swap file
 
nah can we just reset it, already try swapoff swapon thing but still..

thedead1440 2012-09-22 15:49

Re: additional swap file
 
traysh,

Yes to use both swaps...I posted my free output in page 1...The performance for me is slightly increased especially when opening the same app multiple times after it was closed...also the swiping in and out of applications seems smoother to me now that i use this and your fastern9 :D

thedead1440 2012-09-22 15:50

Re: additional swap file
 
Quote:

Originally Posted by ibrakalifa (Post 1270660)
nah can we just reset it, already try swapoff swapon thing but still..

That isn't resetting, isn't it? Thats turning swap on/off...

ibrakalifa 2012-09-22 15:58

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1270662)
That isn't resetting, isn't it? Thats turning swap on/off...

thats why im asking, how to reset the swapram, :|

thedead1440 2012-09-22 15:59

Re: additional swap file
 
use "/sbin/swapon /dev/ramzswap0" or "/sbin/swapoff /dev/ramzswap0"

I'm sure Drop Cahce can't do this as Store QA wouldn't allow it otherwise...

ibrakalifa 2012-09-22 16:10

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1270669)
use "/sbin/swapon /dev/ramzswap0" or "/sbin/swapoff /dev/ramzswap0"

I'm sure Drop Cahce can't do this as Store QA wouldn't allow it otherwise...

nah already try that many times, but still the same..
http://i.imgur.com/IPF93.png

thedead1440 2012-09-22 16:12

Re: additional swap file
 
Can you try typing free in terminal? Maybe DropCache isn't updated :|

traysh 2012-09-22 16:12

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1270662)
That isn't resetting, isn't it? Thats turning swap on/off...

And it has nothing to do with cache. Swap has data of running apps that were moved out of the ram to make room for other apps. Cache is data read from the disk that is not in used by any app anymore but is kept in ram in case an app needs it in the future. There's no cache in swap.

ibrakalifa 2012-09-22 16:19

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1270676)
Can you try typing free in terminal? Maybe DropCache isn't updated :|

well here it is, :/
http://i.imgur.com/Jop3h.png

thedead1440 2012-09-22 16:21

Re: additional swap file
 
It could simply mean that your swap is filled up with data from the RAM...

If that output was what you got after a reboot then we would need to dig deeper into the cause otherwise I think its normal...

kanser 2012-09-22 16:24

Re: additional swap file
 
Quote:

Originally Posted by traysh (Post 1270653)
FasterN9 does not touch swap.

ok then i confused it with something different (but i read anythere something about disabling swap)


Quote:

Originally Posted by thedead1440 (Post 1270661)
The performance for me is slightly increased especially when opening the same app multiple times after it was closed...also the swiping in and out of applications seems smoother to me

Sounds awesome! Now i have to wait for a method that sounds less dangerous :D

ibrakalifa 2012-09-22 16:26

Re: additional swap file
 
Quote:

Originally Posted by thedead1440 (Post 1270683)
It could simply mean that your swap is filled up with data from the RAM...

If that output was what you got after a reboot then we would need to dig deeper into the cause otherwise I think its normal...

nah can we reset it back? Freeing the swapram? Thats what i mean

thedead1440 2012-09-22 16:27

Re: additional swap file
 
Nope you can only turn swap on or off...

thedead1440 2012-09-22 16:35

Re: additional swap file
 
Quote:

Originally Posted by kanser (Post 1270687)
Sounds awesome! Now i have to wait for a method that sounds less dangerous :D


It isn't dangerous actually...Just do the dd command and if you are in open mode copy the script over and you are set...

kanser 2012-09-22 16:53

Re: additional swap file
 
- I dont have open mode (so the script just works with open mode?)
- this is only for super advanced users sounds dangerous :D
- only for advanced users!!! - see above

it's also only for those who don't connect phone "to" mass storage very often -> is a part i didnt understand. Im using my N9 "as" a mass storage sometimes (connecting to my pc). I dont see the context between using this tweak and the mass storage part
it would be very stupid to use the tweak without even understanding the whole warning.

thedead1440 2012-09-22 17:20

Re: additional swap file
 
Quote:

Originally Posted by kanser (Post 1270703)
I dont see the context between using this tweak and the mass storage part
it would be very stupid to use the tweak without even understanding the whole warning.

The swap file is created in the mmc partition which if you connect as mass storage has to be unmounted on the n9 and mounted onto your PC...If you do this frequently you have to frequently mount+unmount your swap which would render it ineffective...If you do this without switching off swap first you might not the mmc mounted or you might get swap having problems...That's the relation!


Anyway, I think Schturman will incorporate this in his N9QTweak app so maybe you can use it from there in the future ;)

kanser 2012-09-22 17:42

Re: additional swap file
 
Ok thx. 1 last question
the mount unmount you speak about:
it doesnt "wear and tear" the hardware right (used google translater here)?
so if the additional swap gets ineffective by mounting frequently it would recover its efficiency by time through swapping if i stop using it as a mass storage.

I hope my question is clear.

death_jax 2012-09-23 08:52

Re: additional swap file
 
1 Attachment(s)
I have Open Mode kernel (because I have nitdroid installed), what packages are needed for command mkswap and swapon/swapoff?

PS: during installation of sudo package, this one show me an error (I attached it) and when I do sudo su show me unable to change to sudoers gid: Operation not permitted.

PS2: setswap0 and rmswap0 attached in the first post are txt files; should I rename them before chmod command, isn't it?

thedead1440 2012-09-23 09:19

Re: additional swap file
 
No no you don't need any packages... All these are system commands...

also if you read what you downloaded you would know they are bash scripts so you either leave them without any file extension or rename them to .sh


All times are GMT. The time now is 16:04.

vBulletin® Version 3.8.8