Reply
Thread Tools
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#71
Originally Posted by sixwheeledbeast View Post
With ereswap IINM you can only have a primary and a temporary swap space.
I wish to have two swaps which I can "flip/flop" to.
I do not get your flip/flop idea.
If you enable another flop location and disbable the flip location, all data will be moved from flip to flop.
Enabling both swaps with same priority does not make sense.
Nad enable them with different priority even less, as only higher priority will be used (except you reach 800MB swap usage, very unlikely).

Only advantage I see is fully omitting swap space (wear) on eMMC.
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Posts: 461 | Thanked: 358 times | Joined on May 2010 @ Bilbao (Basque Country [Spain])
#72
With ereswap you have 2 swap partitions, one on eMMC for backup and one on the SD card for main usage. When ereswap refresh the swap it put on the backup, put off the main and then backwards, put on the main, and put of the backup. These are 4 steps and 2 data movings, using backup swap for the transition.

If you would have 3 swap partitions you would have eMMC one for backup (only if you haven't the SD card or it's broken), and two in the SD card to alternate. When you want to refresh you just put on the swap2 and put off the swap1, and thats all. (Next swap refresh you will put off swap2 and put on swap1). Backup eMMC swap is never used (saving of damage his cells and damaging SD ones) and you only need 2 steps and one data moving. And 2 swap partitions share the damage to sd cells.

I prefer the second method and I will try to modify ereswap to use it. I hope Estel likes the modification and integrates it in ereswap. Maybe could be make an option to use one or two swap partitions on SD Card, as user wants.

Last edited by malkavian; 2012-07-12 at 19:11.
 

The Following 7 Users Say Thank You to malkavian For This Useful Post:
Posts: 78 | Thanked: 24 times | Joined on Feb 2012 @ Moscow
#73
I have N900 with swap on sd card partition. Swap on emmc is disabled.
And i have a problem with some osso applications. RSS, for example, after returning from microb, refreshing to main window, contacts refreshing to top of list after call. Both programs showing "<app name> - resuming" on the top. With emmc swap enabled glitch disappears. What to do?
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#74
Originally Posted by malkavian View Post
With ereswap you have 2 swap partitions, one on eMMC for backup and one on the SD card for main usage. When ereswap refresh the swap it put on the backup, put off the main and then backwards, put on the main, and put of the backup. These are 4 steps and 2 data movings, using backup swap for the transition.
Ah okay. Now I see
I was not aware of second moving back, as I just have my SD swap as higher priority and only disf/enable it. So all data is moved once to eMMC and then read /forgotten from there and all new swap is located again on SD.
Maybe not the best approach, but for me it works nicely.

But two swaps on SD is also good approach to save eMMC wear.
Maybe I add another swap file ...
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Posts: 2,292 | Thanked: 4,135 times | Joined on Apr 2010 @ UK
#75
Originally Posted by peterleinchen View Post
Ah okay. Now I see

But two swaps on SD is also good approach to save eMMC wear.
Maybe I add another swap file ...
Sorry if I didn't explain in the best way.

I could do with a little help with the scripts I am making to complete the rest of my idea in post 67.

Using some of the source of ereswap I have two scripts one for Swapping and one for Switching to Internal (to eject SD safely) but I can't work out how to get the current swaps and use them in the script.

Bit new to the more involved scripting.

If they work it would be possible to make a small app or be incorporated with ereswap somehow.
Attached Files
File Type: gz swapswitch.sh.ver1.tar.gz (544 Bytes, 72 views)
File Type: gz swapswitchejectsd.sh.ver1.tar.gz (554 Bytes, 75 views)
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following 2 Users Say Thank You to sixwheeledbeast For This Useful Post:
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#76
Originally Posted by sixwheeledbeast View Post
Sorry if I didn't explain in the best way.
I think it was me dumbhead here

Sorry no time to look in your scripts, but
cat /proc/swaps
should give you info what swap is enabled...
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 2,292 | Thanked: 4,135 times | Joined on Apr 2010 @ UK
#77
Originally Posted by peterleinchen View Post
I think it was me dumbhead here

cat /proc/swaps
should give you info what swap is enabled...
Ok ta

Using
Code:
cat /proc/swaps | awk '/dev/ {print $1}'
output in a terminal is ok but not in the scripts, tried a few other ways too. will keep researching.
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following User Says Thank You to sixwheeledbeast For This Useful Post:
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#78
You want output to store in a variable?

Normally I use version c
Code:
cat /proc/swaps | awk '/dev/ {print $1}'
awk '/dev/ {print $1}' /proc/swaps

a=cat /proc/swaps | awk '/dev/ {print $1}'
echo $a
b=awk '/dev/ {print $1}' /proc/swaps
echo $b

c=`cat /proc/swaps | awk '/dev/ {print $1}'`
echo $c
d=$(awk '/dev/ {print $1}' /proc/swaps)
echo $d
Or what?

Last edited by peterleinchen; 2012-07-12 at 21:40. Reason: corrected accidentally wrong brackets in version d after seeing vi_s post
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 461 | Thanked: 358 times | Joined on May 2010 @ Bilbao (Basque Country [Spain])
#79
@peterleinchen So when you put off SD swap, all data there is moved to eMMC swap, and afterwards when you put on SD swap, old data is on eMMC one and new data is writed to SD one.

I see a problem: eMMC will be used to have the old data after the refresh, and while your programs need that old data to be readed and loaded in RAM, you will be using some of the eMMC, so your mobile will be a bit slower (remember we use swap on SD for never using eMMC for swap and at the same time data from /home or /MyDocs (in eMMC too), soo we get less stress in eMMC). It's not a big problem, but well, would be better if you only use SD always.

Last edited by malkavian; 2012-07-12 at 21:33.
 

The Following User Says Thank You to malkavian For This Useful Post:
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#80
This toggles between SD/eMMC:

Code:
#!/bin/sh
#swapswap
current_swap=$( cat /proc/swaps | awk '/mmcblk/ {print $1}' | cut -d "k" -f2 | cut -c1)
drivelist=$(sfdisk -lnd /dev/mmcblk1)
swapmicro=$(echo "$drivelist" -n | grep Id=82 | awk '/mmcblk1/ {print $1}')
 
if [ "$current_swap" = "0" ]; then
    if [ "$swapmicro" ]; then
        nice -20 swapon $swapmicro
        nice -20 swapoff /dev/mmcblk0p3    fi
#echo "swap is on sd"
elif [ "$current_swap" = "1" ]; then
    nice -20 swapon /dev/mmcblk0p3
    nice -20 swapoff $swapmicro
#echo "swap is on emmc"
fi
Run this at 4AM or whenever your n900 is out of action:
Code:
#!/bin/sh
#check if device is not in use, if so swapswap!
brightness=$(cat /sys/class/backlight/acx565akm/brightness)
keyboard=$(cat /sys/devices/platform/gpio-switch/slide/state)
 
if [ "$brightness" == "0" ]; then
    if [ "$keyboard" == "closed" ]; then
        echo "/opt/scripts/swapswap.sh" | root 
        echo "/opt/scripts/swapswap.sh" | root 
    fifi
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 5 Users Say Thank You to vi_ For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 05:14.