[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] CTCaer:
Yeah there's always fluctuation. And changes, by how many other threads or hardware are eating from the battery percent pie.

For me there's no change. Because the only thing that can wake my phone is Beautiful widgets, google framework and the stupid google play services (which i have them disabled mos of time.) So the whole Sleep drain (for everything, not only from UKSM) for me is normally 0.3%.

Also a 0.5% sleep drain is the normal for a xperia Ray with a custom kernel. the biggest drain I saw was 0.8%-1% because of the crap signal (one line) I have where my bed is.

Anyway, UKSM freeze support.

this is the scan thread

static int ksm_scan_thread(void *nothing)
{
[B][SIZE="4"]set_freezable();[/SIZE][/B]
set_user_nice(current, 12);

while (!kthread_should_stop()) {
mutex_lock(&ksm_thread_mutex);
if (ksmd_should_run()) {
ksm_enter_all_slots();
ksm_do_scan();
}
mutex_unlock(&ksm_thread_mutex);

[B][SIZE="4"]try_to_freeze();[/SIZE][/B]

if (ksmd_should_run()) {
schedule_timeout_interruptible(ksm_sleep_jiffies);
ksm_sleep_times++;
} else {
wait_event_freezable(ksm_thread_wait,
ksmd_should_run() || kthread_should_stop());
}
}
return 0;
}

Notice the 2 big bold functions?

The 1st one tells the freezer module that UKSM is freezable (it can be suspend by kernel indefinitely until phone wake up).

The 2nd one tries to freeze the thread when the time for early_suspend comes.

So what happens (not only on UKSM, but every app process and kernel process generally):

1. We switch off the screen or screen time out.

2. Android asks processes to complete what they are doing if it's important or declare sleep mode right away.

3. Same for binary system processes.

4. Kernel and hardware time: Kernel checks which threads are running and support freeze (set_freezable() function). Also tries to close as many hardware as it can

5. All threads that support freeze, when the time comes (execute of try_to_freeze() function), they freeze completely and can't wake up if the phone is not coming out of sleep.

UKSM does that exactly when the current scan is done (try_to_freeze() function after ksm_do_scan()).

6. Everything is freezed. Main processor (scorpion core) is shutting off. Only ram and co-processor (baseband as many are calling the AMSS app co-processor) have power and are working.

7. Bonus: Now only the co-processor works, and has in it's memory which apps registered a timed wakelock (don't know how it's called. A wakelock is basically a mechanism to keep your phone from sleeping. But let's use the term timed wakelock :)), and when they are gonna wake up the main CPU for those. For example denying register of a timed wakelock from google's framework and play services, when it's bed time,

will get you the least drain and also wifi will not be always on (cause of play services). Don't know if there's an app that can do this..

This is boldly what's happening when it's night night time for all phones.

So basically means that nothing freezable can awake the phone or prevent it from sleeping.

Not one in a million.

So basically the only way for that to not work, is either a thread went for party time :P (and this will probably cause 100% cpu and maybe a reboot), or that the freezer or suspend mechanism is broken. And that means that the phone can't sleep for sure (and were are talking for extreeeeme screen off drains).

So if UKSM has more than usual screen off time, this is a problem of the too many apps that wake the phone.

Too technical but fun to know what happens, there's no magic here. Only specific functions.

Honami mini or "Ray3" (4.3" and 4" as the rumors say), will have very small bezels, so that means for me, near Ray experience.