ZRAM? How to edit disksize? - Android Stick & Console AMLogic based Computers

I have a Kata Box 2 with s905 SoC with 1GB of ram
My current ZRAM value is set at 500MB with a swappiness of 60%
I can disable zram or change the swappiness of my ZRAM but I cant seem to change the disk size.
I tried this in the terminal with su
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
busybox echo 157286400 > /sys/block/zram0/disksize <- I want to lower it from 500mb to 150mb
mkswap /dev/block/zram0
swapon /dev/block/zram0
I checked the value of /sys/block/zram0/disksize and its still set at 500mb or nothing has changed.
I tried to edit the manually but its not saving at all.

Related

[Q] how can i enable/disable zram on nightelf

How can i enable or disable zram on nightelf kernel??????
And how do i know if it is enabled or not now??
ALI 9 said:
How can i enable or disable zram on nightelf kernel??????
And how do i know if it is enabled or not now??
Click to expand...
Click to collapse
Search first or use google !!!!
Sent from my Neo V with Supercharged ICS 4.0.4
How to make simple ZRAM init.d script
1. Using Root Explorer, got to /sytem/etc/
init.d/
2. press Menu then create new file
3. paste these in it
#!/system/bin/sh
sysctl -w vm.swappiness=40
echo "1" > /sys/block/zram0/reset
echo $((50*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
4. close and save it as 60ZRAM
5. set permission to 777 or "rwxrwxrwx" (tick
all)
6. take note: 50 *1024*1024 = 50MB zram
disksize. if you want to set 30MB, change 50
to 30.
To check download terminal emulator and type
su
free
if you see swap memory, that means thats activated
Source:
http://forum.xda-developers.com/showthread.php?t=1630532
F.A.I.S.A.L said:
How to make simple ZRAM init.d script
1. Using Root Explorer, got to /sytem/etc/
init.d/
2. press Menu then create new file
3. paste these in it
#!/system/bin/sh
sysctl -w vm.swappiness=40
echo "1" > /sys/block/zram0/reset
echo $((50*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
4. close and save it as 60ZRAM
5. set permission to 777 or "rwxrwxrwx" (tick
all)
6. take note: 50 *1024*1024 = 50MB zram
disksize. if you want to set 30MB, change 50
to 30.
To check download terminal emulator and type
su
free
if you see swap memory, that means thats activated
Source:
http://forum.xda-developers.com/showthread.php?t=1630532
Click to expand...
Click to collapse
i did all but when i enter
su
free
on terminal it says nt found.. using nightelf 1.5 . any suggestion ?
Then try SetXperia.
No need for scripting.
Just choose "Make swap on boot", set your method in "Edit", e.g. ZRAM, set your size (e.g. 64MB, all above is not recommended), set swappiness (40), reboot, done! :good:
c1ph4 said:
Then try SetXperia.
No need for scripting.
Just choose "Make swap on boot", set your method in "Edit", e.g. ZRAM, set your size (e.g. 64MB, all above is not recommended), set swappiness (40), reboot, done! :good:
Click to expand...
Click to collapse
i hv got a 50 mb swapfile on system ... How to use it? Will it give me more free ram?
@Suranjan16049:
No, RAM is from the manufacturer of the phone. Should be 512MB in Xperia Neo V. Not upgradeable.
Swap will be used if RAM is full. It's Linux-specific. Not needed with modern kernels though.

[Q] How to configure zRam

hello..
I'm using xperia active and I want to configure the zRam..
I currently on stock ICS rom. I use Diskinfo apps to check ram swap and it shows i have 60mb ram swap for default. but i didn't apply any zRam or swap script yet. So use this script to configure the zRam
#!/system/bin/sh
sysctl -w vm.swappiness=60
echo '1' > /sys/block/zram0/reset
echo $((30*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
and set it in init.d (i have activate the init.d). I try to set lower value than 60mb which is 30mb but I can't see any changes when I check back at Diskinfo apps..I also check it using terminal emulator by typing "free" but it still same as shown Diskinfo.. Is there any other method can I use to configure the zRam?
p/s : sorry for bad english
pojhe said:
hello..
I'm using xperia active and I want to configure the zRam..
I currently on stock ICS rom. I use Diskinfo apps to check ram swap and it shows i have 60mb ram swap for default. but i didn't apply any zRam or swap script yet. So use this script to configure the zRam
#!/system/bin/sh
sysctl -w vm.swappiness=60
echo '1' > /sys/block/zram0/reset
echo $((30*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
and set it in init.d (i have activate the init.d). I try to set lower value than 60mb which is 30mb but I can't see any changes when I check back at Diskinfo apps..I also check it using terminal emulator by typing "free" but it still same as shown Diskinfo.. Is there any other method can I use to configure the zRam?
p/s : sorry for bad english
Click to expand...
Click to collapse
Try running the script in ScriptManager or in Terminal (will need to be run as su). Any errors you see will also be occurring when the init.d script runs. If there aren't any errors and you reset your swap space then maybe your init.d isn't set up correctly. If you lose your new settings during a reboot, then something in the kernel or ROM is setting these values after init.d runs.
This is really weird, i got the same problem with stock kernel. Before, i thought swap wasn't even supported, but it's set in stock kernel, i can't modify it either, but i'm glad i have it on my locked bl, i thought it was impossible.
justmpm said:
Try running the script in ScriptManager or in Terminal (will need to be run as su). Any errors you see will also be occurring when the init.d script runs. If there aren't any errors and you reset your swap space then maybe your init.d isn't set up correctly. If you lose your new settings during a reboot, then something in the kernel or ROM is setting these values after init.d runs.
Click to expand...
Click to collapse
I found it.. the default zRam script actually located at /system/bin/zram_start.sh. So I just edit this script to adjust the desired value of zRam.. Thanks mate!
pojhe said:
I found it.. the default zRam script actually located at /system/bin/zram_start.sh. So I just edit this script to adjust the desired value of zRam.. Thanks mate!
Click to expand...
Click to collapse
Nice, what did you edit? I want to set it to 128

What Init.d and Build.prop tweaks do you Recommend?

For those of you who like to do additional tweaks to your phone, what init.d and build.prop tweaks do you use? I've noticed some of them try to override crpalmer and Zarboz's kernel settings so I removed them. Also, I've read that some of these tweaks don't help at all.
So what tweaks do you recommend, if any, that play well with the DNA and with custom kernels?
Currently I have speedscript in my init.d folder but I noticed no benefit or detriment so I may just remove it. I also reduced the WiFi scan interval in the build.prop. I would like to add more tweaks since I can't leave well enough alone.
I'm looking for speed and battery improvements which can he a fine balancing act. I also want to increase the scroll speed as wel as change the autobrightness settings so it's more biased to lower brightness. I'm not sure if those could be achieved with init.d or build.prop tweaks.
#Render graphics with GPU&CPU
debug.composition.type=cpu
debug.composition.type=gpu
#For Faster Startups Disable Boot Animation
debug.sb.nobootanimation=1<<< faster
[QOUTE]Many build.prop tweaks set this value to 300, but it seems this is a bad idea. As Google points out, Android maxes out at 60fps. The default value is already allow for a possible max_events_per_sec of 90. Even if you allow for 300 max_events_per_sec, you’ll only ever see 60 of these events in any given second. Therefore, any value much higher than 90 is unlikely to have any noticeable impact on your experience in general. Additionally, setting this value too high can starve other UI events that need to get processed, viz. touch inputs. You’re not likely to feel like your device is running very smoothly when it is busy processing thousands of scroll events instead of responding immediately to you clicking to try and open a link or an app. There may be some specific scenarios where increasing this value does appear to improve system feedback, but changing this value for all UI events across the board will likely cause more problems than it will solve.[/QOUTE]
# faster Scrolling
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
# improve voice call clarity
ro.ril.enable.amr.wideband=1
# disable error checking
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
# faster youtube?
ro.ril.hep=0
# Faster boot
persist.sys.shutdown.mode=hibernate
# does not need to be on if not a dev
persist.android.strictmode=0
# disable USB debugging icon from status bar
persist.adb.notify=0
# Qualcomm display settings
debug.qctwa.statusbar=1
debug.qctwa.preservebuf=1
com.qc.hardware=true
# BATTERY SAVING-----------------
ro.ril.disable.power.collapse=1
ro.mot.eri.losalert.delay=1000 #smooths out network disconnects. breakes tethering in CM7.
ro.config.nocheckin=1 #disable sending usage data to google
# sleep modes
pm.sleep_mode=3<<< thats my personal mode used
#usage:
#pm.sleep_mode=0 -> collapse suspend
#pm.sleep_mode=1 -> collapse (will totally power off the cpu)
#pm.sleep_mode=2 -> sleep (cpu is still on, but put into low power mode (registers are still saved)
#pm.sleep_mode=3 -> slow Clock and Wait for Interrupt (lowered frequency and voltage)
#pm.sleep_mode=4 -> wait for interrupt (no change in cpu clock or voltage)
# locks launcher in memory (not recommended on low RAM devices)
#ro.HOME_APP_ADJ=1
check some of thoses out and maybe that will help in what your looking for
internet speed tweaks
Code:
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "404480" > /proc/sys/net/core/wmem_max;
echo "404480" > /proc/sys/net/core/rmem_max;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "256960" > /proc/sys/net/core/wmem_default;
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
vm management tweaks
Code:
echo "4096" > /proc/sys/vm/min_free_kbytes
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/swappiness
echo "50" > /proc/sys/vm/vfs_cache_pressure
echo "90" > /proc/sys/vm/dirty_ratio
echo "70" > /proc/sys/vm/dirty_background_ratio
misc kernel tweaks
Code:
echo "8" > /proc/sys/vm/page-cluster;
echo "64000" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "10" > /proc/sys/fs/lease-break-time;
echo "500,512000,64,2048" > /proc/sys/kernel/sem;
5. battery tweaks
Code:
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
6. EXT4 tweaks (greatly increase I/O)
(needs /system, /cache, /data partitions formatted to EXT4)
removes journalism
Code:
tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data
b) perfect mount options
Code:
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier =0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodir atime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodir atime,barrier=0,nobh /cache
Flags blocks as non-rotational and increases cache size
Code:
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
microSD card speed tweak
Code:
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
Defrags database files
Code:
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done
Auto change governor and I/O Scheduler
a) I/O Scheduler (Best: MTD devices - VR; EMMC devices - SIO) - needs kernel with these
Code:
echo "vr" > /sys/block/mmcblk0/queue/scheduler
or
echo "sio" > /sys/block/mmcblk0/queue/scheduler
b) Governor (Best: Minmax > SavagedZen > Smoothass > Smartass > Interactive) - needs kernel with these
Code:
echo "governor-name-here" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Move dalvik-cache to cache partition to free up data partition space <<< do this only if room is availble
Code:
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
Disable normalize sleeper
Code:
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
there does those 2 posts help you out orange
---------- Post added at 08:52 AM ---------- Previous post was at 08:51 AM ----------
also some of these are just examples so just modify for your needs cool?
---------- Post added at 08:54 AM ---------- Previous post was at 08:52 AM ----------
autobrightness you need to decompile framework-res.apk

Underclocking app for SD 625

What good app you preffer for underclocking SD625? I want an app thar can underclock and if posible undervolt CPU and turn off some cpu cores. I have RR 5.8.5 with Electrablue 7 kernel.
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
nikkky said:
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
Click to expand...
Click to collapse
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
DarthJabba9 said:
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
Click to expand...
Click to collapse
Do you know the command for changing governors?
nikkky said:
Do you know the command for changing governors?
Click to expand...
Click to collapse
Unfortunately, no.
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
When I try for example echo "0" > /sys/devices/system/cpu/cpu6/online I got permission denied. I used Material Terminal app.
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
nikkky said:
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
Click to expand...
Click to collapse
Yes. Running the "su" command is what converts your terminal session into a root terminal session

Enable swap

Dear developers,
When porting roms, I see that some roms enable swap by an init.d script (below is an example) or directly from boot.img. When I searched swap, I found that it is usefull for phones which have less than 700mb ram. But what about a phone with 1Gb ram, is it still usefull or will it use much more battery? What do you suggest for 1Gb ram, enable swap or disable it?
Thanks for your help.
#!/system/bin/sh
echo 536870912 > /sys/block/zram0/disksize
echo 100 > /proc/sys/vm/swappiness
/system/bin/tiny_mkswap /dev/block/zram0
/system/bin/tiny_swapon /dev/block/zram0

Categories

Resources