yashsingh1/xdaforums huggingface dataset:
[Galaxy S II General] MikeVirtual:
Confused by ondemand down_differential

Hi Droidphile,

After seeing the posts on Siyah thread leading to you revising this explanation today, I am confused.

max_load_freq is presumably the highest cpu frequency allowed eg 1200 mHz

up_threshold is a percentage of cpu utilisation eg 85%

down_differential is ??? suggested values are 1, 5, 15

No matter how I try and do the math, can't make sense of

1200 / (85-5) = 15

How does 15 relate to target frequency?

Sorry if I'm being stupid/taking things too literally, but I just want to understand.

Thanks in advance,

Mike
[Galaxy S II General] AndreiLux:
Sample (n)

max_load_freq is initialized to 0. The governor polls the CPU driver to tell it what "average" frequency it was at since the previous sampling.

It polls the wall_time from the CPU, it's a continuous counter storing the uptime of the CPU. It polls the idle_time, also a counter storing the amount of time a CPU is idle. It calculates the load by taking the wall_time minus the idle_time and you end up with a percentage which describes the load of the cpu. ( load = 100 * (wall_time - idle_time) / wall_time; )

It takes the load times the average frequency to calculate an arbitrary frequency which describes how much speed the device theoretically needs for 100% of the work done on it. This is load_freq.

Because we have multiple CPU cores, and we are running them on the same frequency and cannot run them on asychronous frequencies, the same thing is done for each core. max_load_freq is then the maximum load frequency as calculated above for each core. max_load_freq is not an actual frequency run by the CPU.

The governor can now splits into two things:

If max_load_freq is greater than up_threshold * current frequency, then it will tell the CPU driver to scale to maximum frequency. The rate multiplier is set by sampling_down_factor. Keep in mind that smooth scaling is done by the CPU driver and not the governor.

The next sample will be (n+sampling_down_factor).

If max_load_freq is smaller than (up_threshold - down_differential) * current frequency, then it calculates an arbitrary frequency which will hold the current maximum load for the next sample without triggering up_threshold. down_differential is there just to act as a safeguard to give the workload more flexibility so that it won't scale down too aggressively. This next arbitrary frequency is passed onto the CPU driver and he will look into the frequency table and change to the state with the next-highest frequency.

The next sample will be (n+1).

_______________________________________

Now if you do the math correctly in your example; first of all, now you know max_load_freq cannot be 1200 like in your example. Let's assume it's 587. Also remember we're using percentages here, you calculated with integers.

587 / (0.85 - 0.05) = 733

So the governor tells the CPU driver to set it to 733MHz, the CPU driver rounds that up to the next frequency in the table which would be 800MHz. Theoretically now, assuming the load will be constant, the CPU will already be at a frequency capable of supporting it, and sure of not triggering the up_threshold.

Now if you see in the numbers above, how it's stupid to have a high down_differential. The target frequency is getting rounded up once by the up_threshold, once by the down_differential, and then at the end again by scaling it to an actual frequency state on the CPU. In that above example with those thresholds, you have a CPU which will be physically idle for 36% (!!) of the time. This is why ondemand thresholds are way different than interactive based ones, and you can get away with very high thresholds.
[Galaxy S II General] MikeVirtual:
Hi AndreiLux,

Knew I'd missed something!;)

Thank you for an extremely thorough answer. I'm just gonna go back and read it a few more times to digest it, but that was exactly what I was looking for. If you don't know how it works, you can't expect to tweak it favourably.

Cheers,

Mike
[Galaxy S II General] droidphile:
I was in deep sleep, so was my GS2 :)

Thanks Andrei for that beautiful explanation. I will link to this post in the OP.
[Galaxy S II General] androidkid311:
What he said lol

looks like an iphone but powered by android baby!!!!
[Galaxy S II General] bearsblack:
This is one of the best posts ever. Thank u so much :D

I <3 Ice Cream Kangwiches
[Galaxy S II General] jjjameson:
thank you.. great guide.
[Galaxy S II General] kwezi:
As a flashomaniac this info is invaluable.

Thanks a bunch
[Galaxy S II General] Siam77:
This is a great job! It always helps me to understand the system of my phone.
[Galaxy S II General] the1dynasty:
Running mathkid's matr1x 15.0 bfs right now and there's a "wheatly" governor included... Anyone care to break that one down for us please?
[Galaxy S II General] droidphile:
I will try adding wheatly to the governor list. Only problem is, the kernel i'm using does not have this governor so i can't test the tunables. Nevertheless, i will put an explanation.
[Galaxy S II General] Entropy512:
BTW, "lionheart" is not original work by knzo.

If you do a diff of lionheart vs. conservative from the void.echo source tree, you will see the following:

1) All comments deleted (Why? Only possible explanation would be an attempt to hide the origins of the code.)

2) Most tuning parameters deleted

3) A few backports of upstream patches to the conservative governor

4) Hardcoded reduction of the minimum polling interval to a minimum of 10000 usec - this is where 99% of the benefits of "lionheart" lie

Netarchy's conservative governor tuning patch dates back to August 17, LONG before the initial release of knzo's thread. Instead of hardcoding, it preserves the safety mechanisms in the kernel, so the patch is actually portable to other source trees.

See https://github.com/netarchy/infuse4g-sources/commit/e4ab71ad9028bd5a38ba398c066878e40157f3d0 for reference - note the date on this patch.

It's sad that a patch with such simple benefits receives very little attention until renamed and over-marketed as being WAY more than what it really is (The reality - a two-liner patch - the other two lines changed are just altering defaults in the patch above).
[Galaxy S II General] CamoGeko:
I bet that's because no one actually knew that it was so amazing until it was "over-marketed" to attract the attention of users.

To be honest, it's a simple strategy used all over the world. The only thing that's sad is that most of the time is that the original founder/creator hardly ever gets credit for it.

It's the world we live in.
[Galaxy S II General] droidphile:
Refined Lionheart explanation in the OP. I hope that's the truth.
[Galaxy S II General] Entropy512:
The one thing to change would be that to change the polling rate, a patch IS required, such as netarchy's.

SiyahKernel has had the patch since 11/26 at least, maybe earlier (change history prior to 11/24 is difficult, bitbucket kicks the bucket when you look at earlier patches from before gokhan started maintaining there). His code's origin is netarchy's and I believe he gave credit. (In fact I think I might have pointed the patch out to him.)

I've had the patch in my I777 tree since October 6, 2011 (before void even existed!) - https://github.com/Entropy512/linux_kernel_sgh-i777/commit/3b92eb76e72bbaa88aa8d87d306d1b61c9485912 (Mine does have a higher limit than gokhan's code or the Lionheart code, as I prefer to have more safety margin before getting too close to the CPU's transition latency. Poll too fast and you might hurt things by having the governor use poor CPU usage estimates.)

Simone201 has had the patch in NEAK since October 28, also before Void even existed.
[Galaxy S II General] droidphile:
Yeah i know 10,000uS sampling interval = 10 millisec which is almost the transition latency of CPU.

20,000 would be safer and can still satisfy "response-factor" of Lionheart.
[Galaxy S II General] the1dynasty:
i can wait... so far i've been getting much better battery life with this combo noop/wheatley... +7hrs and 75% left... every other combo i had would for sure be in the 60's with the use i've had today!! it runs pretty smooth too... streaming music wonderfully, texting, calls, etc all are fine... haven't tested much else right now! thanks for keeping this thread updated!!!
[Galaxy S II General] the1dynasty:
Wheatley = best governor for my phone for great battery and performance!! nearly 19hrs with over 4hrs of screen-on and it's time for me to sleep so i'll connect it to the charger with about 20% left!!
[Galaxy S II General] aLNG:
which kernel u used?

i wonder wheatley is really working for ns? do ns have C4-state like Gnex?
[Galaxy S II General] the1dynasty:
using Matr1x 15.0... the OP said that NS does not have C4 so he was going to remove the "Wheatley" option from his next release but several people are reporting much better battery life than with other governors so he's gonna keep it in there now... someone said it's essentially "Ondemand - C4" but i've used that setting and not even close what i'm getting with this one right now!
[Galaxy S II General] aLNG:
aaa..ok thanks

ondemand tweak :)
[Galaxy S II General] hazard209:
When using sleep_ideal_freq for smartassV2, I'm guessing it's the same as using any other governor settings in init.d?

For example, I created a new script in init.d called 95smartassedit and wrote this:

#!/system/bin/sh

echo "100" > /sys/device/system/cpu/cpufreq/smartassv2/sleep_ideal_freq

Is this the correct syntax and is 100 a good/proper value? There's not really much about application in the op.
[Galaxy S II General] droidphile:
1) Settings for all the governors are 'identical' as long as the parameters are specified correctly with valid values being echoed.

2) If you meant to use 100 mhz as sleep_ideal_freq, then it should be

echo "100000" > /sys/device/system/cpu/cpufreq/smartass/sleep_ideal_freq

3) Directory name of the governor is "smartass" not "smartassV2" i believe. :)

4) By application you mean no smartassv2 tweaks or no guide on init.d scripts?

I will add sample tweaks for smartassv2 tweaks today if possible.
[Galaxy S II General] hazard209:
I meant in applying the setting via init.d for smartassV2, but you've answered my question completely.

Thank you for all your hard work in putting this together and maintaining this thread! It's very informative and insightful.
[Galaxy S II General] Entropy512:
I've been reading up on Wheatley, and while the concept is interesting (and likely valid on the architecture it was designed for), our CPU has a very different architecture, and I question whether Wheatley contains any measurable benefit on Exynos Gingerbread devices.

Another reason to build a dummy battery with a current sensor...
[Galaxy S II General] droidphile:
That's what even i was thinking. Can not find any good feed back in phoenix thread. (v1.25 onwards features wheatley as well).

Ezekeel never stops making 'derived' governors from ondemand. Does he? :)

Also, isn't it a little close to Lazy governor.

No of misses and target residency sounds interesting, but will it prevent use of lowest frequency on 'idle' is the question.

This is the core part

if (total_usage > 0 &&
total_idletime / total_usage >= dbs_tuners_ins.target_residency)
{
if (num_misses > 0)
num_misses--;
}
else
{
if (num_misses <= dbs_tuners_ins.allowed_misses)
num_misses++;
}

if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur
|| num_misses <= dbs_tuners_ins.allowed_misses)
{
/* If switching to max speed, apply sampling_down_factor */
if (policy->cur < policy->max)
this_dbs_info->rate_mult = dbs_tuners_ins.sampling_down_factor;
dbs_freq_increase(policy, policy->max);
return;
}
[Galaxy S II General] milan188:
Best explanation thread ever created on XDA
[Galaxy S II General] ithehappy:
Great thread. Answers almost everything regarding Governers and Schedulers. Nice.
[Galaxy S II General] maurogg84:
I set the performance tweaks for ondemand in a script in the init folder. How do I check in the terminal if the settings went through?
[Galaxy S II General] droidphile:
Using terminal, you can cat each of the file you had echoed tweaks into and see if the values are what you wanted.

Ex: cat /sys/devices/system/cpu/cpufreq/ondemand/up_threshold

Alternatively, you can use ScritpManager to run the script as root and if the run is success, (exit code=0) your settings did go through.
[Galaxy S II General] maurogg84:
$ export PATH=/data/local/bin:$PATH

$ su

# s/devices/system/cpu/cpufreq/ondemand/up_threshold

95

# ices/system/cpu/cpufreq/ondemand/down_differential

cannot create /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor: directory nonexistent

# s/devices/system/cpu/cpufreq/ondemand/up_threshold

95

#

Something is blocking the settings from changing, I'm using voltage control , do you think that might be the problem?

The up_threshold was supposed to be 70, then I tried to echo all the settings then something came out about directory non existent

Humble Charge 5.0

Fuju tweaks ICS 4.0

Supercharged v6

Kickasskernelizer
[Galaxy S II General] droidphile:
There will be syntax error(s).

Check for extra spaces and delete them from end of each line. (even from beginning if found).

You can use script manager editor from your device.
[Galaxy S II General] ejatds:
im getting a green flash every time i turn on the device. any way i can change any settings (voodoo colour?) to fix this?

i don't see any colour options in voodoo control, running gummynex
[Galaxy S II General] droidphile:
Question non-related to this thread.

However, try these

1) Use different gamma sets in voodoo scr tuning app

2) Change brightness curve settings via parameters, if you're using a kernel that supports modification of brightness curve settings (like Siyah)

3) Download and install the app from this thread. You can change rgb colors and temperature. Make sure you write down the default settings somewhere. Uninstalling app after changing something will retain those changes.
[Galaxy S II General] the1dynasty:
just curious, any specs on "Wheatley" yet? i keep reading stuff about it only having benefit on the Galaxy Nexus... something to do with the GN having "C4" in it... i've been running it on my NS4G and hands down, it's my favorite governor!!
[Galaxy S II General] coloxim:
hi....sorry for my english and for my question...

can I reduce the brightness more than 0?

at the night my display is too much light...

can i set the min_gamma to -10 or something like that?

bacuase i've tried jiuce defender and it set the brightness very low...

can you check it?

thank you so much...
[Galaxy S II General] droidphile:
You said the answer yourself.

I didn't put an explanation for wheatley here because of few simple reasons

1) Wheatley was originally authored for a different platform and architecture OMAP4, which has nothing to do with exynos Soc in GS2.

2) The concept is actually good but might not be suitable for GS2 CPU as of now, atleast from the response of phoenix kernel users.

3) Race-to-idle is under question. Staying at i) lower time in higher frequency+easing into idle modes staying higher time in idle states OR ii) spending more time at lower frequency+less time on idle modes. Which of these saves more power; should be tested upon.

You want to increase the minimum brightness if i understand correct. Try these.

min_bl: 0

min_gamma:1

max_gamma:24

Negative values are not valid. Because min_bl refers to the sensor read values.
[Galaxy S II General] coloxim:
so min_gamma:1 is the lowest brightnes and max_gamma:24 is the max luminosity?
[Galaxy S II General] ejatds:
sorry posted this on the wrong thread :/

thanks for the help though :)
[Galaxy S II General] the1dynasty:
thanks for the reply... i was sub'd to this thread and didn't realize it was in the GSII forum... just thought it was a general forum or something lol...
[Galaxy S II General] Kocai:
Thank you for the post. Can't 100% understand everything but it gives me a general idea of the stuff that you posted.
[Galaxy S II General] GJ123:
Thank you very much!

Waiting for the Smartassv2 tweaks (:

Or does anybody have any good Smartassv2 tweaks?
[Galaxy S II General] QUALIA_021:
I'm a Chinese student ,with my poor Engish I read it slowly, and I couldn't understand it all. But thank you droidphile, I saved your post ad a document in my PC, for anytime I can read it. And so sorry for that our country couldn't use Paypal.
[Galaxy S II General] droidphile:
I have tried using simplest language possible to write the thread.

You don't have to be sorry for your country not having paypal. Do you see a donation button or link anywhere 'around' me? :)

Donations are for developers who deserves it. Not for people like me who is only sharing knowledge.
[Galaxy S II General] ljordan2:
Thanks man clears lots of things :)
[Galaxy S II General] incubus_fr:
Nice mentality mate!
[Galaxy S II General] maurogg84:
I hope you don't mind, I've built a script thanks for your information, the only thing that doesn't stick after reboot is the governor, if I run the script while the phone is on, it works, can you check if I did anything wrong?

#!/system/bin/sh

echo "0 0 0 0 0 0 0 50 75 100 100 200" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table

echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo "0 0 0 0 0 1 1 1 1 1 1 1" > /sys/devices/system/cpu/cpu0/cpufreq/states_enabled_table

echo "sio" > /sys/block/mmcblk0/queue/scheduler

echo "1300000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
[Galaxy S II General] droidphile:
You mean to say all other parameters stick except for governor? What's your device and kernel. Kernel has interactive governor in the list of available governors right.

And i don't understand the UVmV table values. What are these 12 values parsed into?

If you think script works when run after a reboot, then something is reverting the governor to default during booting. Try a sleep 30 as the first line in the script (after #!/system/bin/sh) and wait enough after reboot. Wait for 1 minute after reboot and then check SetCpu/Voltage Control or whatever app you're using to check if governor sticks.
[Galaxy S II General] maurogg84:
Yes the kernel has the interactive governor. I'm on the Droid Charge with latest imnutz' PBJ Kernel.

UVMV is to reduce the voltage on each level. So you are saying type "sleep 30". I'll try that and and report back to you.
[Galaxy S II General] Phelicks:
*post deleted*
[Galaxy S II General] ithehappy:
Please DELETE this post, wrongly posted in this topic.

Thank You.
[Galaxy S II General] Vepo:
Nice thanks
[Galaxy S II General] maurogg84:
Thanks, 20 seconds did the trick.
[Galaxy S II General] Aidan.Collard:
Missing ftdi_sio.ko and usbserial.ko modules

First of all - the description of kernel modules and how they are activated was just what I needed!

I have Siyah v2.6.10 loaded on a Samsung Galaxy S2 and am attempting to connect to an FTDI usb-to-serial device. After reading this thread, I realise that I need to activate the usbserial.ko and ftdi_sio.ko modules - however they are missing from /lib/modules.

I have attempted to source the modules from elsewhere - but they will not load (I guess that the ones that I found have been built with a different tool-chain).

Anyone got copies of these two modules?
[Galaxy S II General] keiemz:
OMG! wonderful! Thank you very much. It is really good.
[Galaxy Tab Q&A, Help & Troubleshooting] devlinfedrick:
help!what should i do to fix this problem?i had this problem after i tried to flash 2.3.3 on my galaxy tab p1000.i tried to start the tab normally and download mode but same picture came out..!can i still fix this??? it happened after i the attempt of flashing failed,i don't know what to do.i read someone posted saying about ''jm6.zip'' but i can't find it anywhere.and what does it do actually? and if i were to re-flash a firmware, which firmware should i use?
[Galaxy Tab Q&A, Help & Troubleshooting] erkangur:
*Be sure you plugged your tablet to your PC with USB and you're seeing "Phone->/!\->Computer" screen.

*if you re running windows be sure you installed usb drivers

*install heimdall command-line tool

*type "heimdall close-pc-screen" into the terminal

*watch the magic happens.
[Galaxy Tab Q&A, Help & Troubleshooting] dsb9938:
You're in download mode.

Load something with Heimdall.

D
[Galaxy Tab Q&A, Help & Troubleshooting] devlinfedrick:
thank you!will try this method soon!
[Galaxy Tab Q&A, Help & Troubleshooting] devlinfedrick:
Hello..where should i type the command?i cannot find ''terminal''..please help me..
[Galaxy Tab Q&A, Help & Troubleshooting] 120825:
Usually it happen when we have a damage rom.

Try to download again the rom.

Power on the galaxy tab and try to flash the rom again.

Don't forget to restart the tab by pressing the power on. When the tab connected to the pc and the flashing is failed
[Motorola Droid RAZR] TechBSwift:
I rooted my phone using the bonic bootstrap for my droid razr. Although everthing worked out correctly I want to install the razr bootstrap so I can backup and restore my phone.

Does anyone know how I should go about installing the razr bootstrap and deleting the bionic bootstrap?
[Motorola Droid RAZR] MrFrankfromCM:
You should just be able to follow this...let the OP verify however.

http://xdaforums.com/showthread.php?t=1341578
[Motorola Droid RAZR] TechBSwift:
.

can any one else help me with this? i followed zedomax and installed the bionic bootloader to root. i would like to install the modded version for the razr
[Motorola Droid RAZR] branshaw09:
Are you referring to boostrap recovery app?? There is no access or root of the bootloader as it's locked up.

After you rooted your Razr did you install the Bionic bootstrap recovery? If you're refering to the recovery app then uninstall the Bionic bootstrap app, delete the clockwork mod file on your sdcard and then install the Razr bootstrap. I think this should update clockwork (if it's different) and then place a new clockwork folder on your sdcard.
[T-Mobile LG G2x] abdulsaleh:
:mad: I have a g2x. My phone is currently on Miui . But I tried switching back to stock rooted froyo. My phone is rooted, and is on Miui. I dislike this rom , and wanted to switch back.

Problem: I wipe data and cache everything .go to install zip, choose the stock froyo zip I found in xda. I click it and it says installation aborted. It's been very very frustrating. Since I leave to Europe in 2 days I can't stand to have Miui for 2 weeks. What can i do. Thanks :D
[T-Mobile LG G2x] 96traxx:
Try restoring your backup.
[T-Mobile LG G2x] mt3g:
Might be a bad download. Redownload the file and make sure its a full file size 1xx MB rom.
[T-Mobile LG G2x] abdulsaleh:
My backup was accidentally deleted. I can't restore any rom. Thanks
[T-Mobile LG G2x] phburks:
Is the stock froyo zip a flashable zip or is it a zip file containing a nandroid backup? What are the contents of the zip you're trying to flash?
[T-Mobile LG G2x] abdulsaleh:
android_secure.img

.DS_Store

boot.img

cache.img

data.img

nandroid.md5

recovery.img

system.img
[T-Mobile LG G2x] tahahawa:
It's a nandroid. Put those files (extract them) to /sdcard/clockworkmod/backup/??? And nandroid restore them.
[Xperia Play Android Development] IE-coRe:
What I did:

Followed the instructions from XMIUI but took instead of the XMIUI zip the latest Blend Miui (V9) from here: http://xdaforums.com/showthread.php?t=1302802 (Arc Version)

The Result was a suprise for me. It boots. Its smooth. Its Awesome.

Bugs:

Autorotate is wrong

Wifi says error

bluetooth does not turn on

it thinks its an ARC

of curse touchpads

camera

maybe more

Download:

Here

Multiupload Mirror

I think most of the bugs can be fixed but i am not a dev. (for now)

I played a bit arround and swapped some files from XMIUI like build.prop and some others and now Autorotate works and it thinks it is a Xperia Play but i think the rest is impossible for me. I will upload it if someone is interested.