maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   BFS for the power kernel (https://talk.maemo.org/showthread.php?t=58780)

coreyoconnor 2010-07-20 06:23

BFS for the power kernel
 
Hi all!
I have completed a first attempt at applying the BFS scheduler patch to both the power and the stock 2.6.28-omap1 kernel.

The debian files here:
http://coreyoconnor.com/downloads/
Will install the equivalent of the latest kernel-power + BFS patches. This can be installed over kernel-power just fine; The package manager will consider it an update.

The patch for the stock kernel is located at:
http://coreyoconnor.com/downloads/ke...6.28-bfs.patch

I will be packaging up the patch for kernel-power shortly.

For me kernel-power + BFS works great. Still, since I just got this working only apply if you are OK reflashing your device if something goes wrong. This will uninstall in the same way as kernel-power.

The basic procedure for patching the stock kernel is similar to what is listed here:
http://natisbad.org/N900/n900-custom-kernel.html

suppose your stock kernel source is in the directory kernel-2.6.28-stock and the patch file is copied to the same directory then the procedure is
Code:

host# cd kernel-2.6.28-stock
host# patch -p1 < kernel-2.6.28-bfs.patch

At this point all patches should be applied OK. If not, well, something went wrong and you should let me know.

Now switch to the kernel-2.6.28-stock within the scratchbox environment
Code:

[sbox-FREMANTLE_ARMEL: ~/kernel-2.6.28-stock] > make rx51_defconfig
[sbox-FREMANTLE_ARMEL: ~/kernel-2.6.28-stock] > make oldconfig
[sbox-FREMANTLE_ARMEL: ~/kernel-2.6.28-stock] > make

This should build the kernel and all required modules just fine.

I'm going to leave the instructions incomplete. If you've flashed a kernel and updated the kernel modules on your device you should be fine. Otherwise.. try it with the stock kernel first!

How to package this up into a deb? Any pointers?

UPDATE
I have uploaded deb packages that are equivalent to the latest kernel-power packages plus the bfs patches.

dchky 2010-07-20 10:56

Re: BFS scheduler for N900
 
Where are your benchmarks? Unless this patch makes things perceptibly faster, (and subjective is not a good enough metric) then what is the point?

coreyoconnor 2010-07-20 15:08

Re: BFS scheduler for N900
 
Ask the Android kids what the point is.

Plus, if you had read up on BFS you'd know it's goal is to reduce latency and benchmarking latency is much harder than the typical benchmarking of a single process performance. Which is what most benchmarks tests. Good for testing overclocking, doesn't tell you much of anything in this case. I can think of a few good latency tests but the error bounds may be quite high. Unless somebody has a robot to push buttons for me....

Single process benchmarks, like a web browser javascript benchmark, are easy to schedule. So the difference between CFS and BFS should be negligable. Still, i might as well run a few. what benchmarks would you like to see?

One subjective difference that is significant enough to, IMO, be interesting is: the speed of my interactions with the phone are not diminished significantly when i am installing an application in the background. Not even the silly little graphical effects.

dwaradzyn 2010-07-20 15:53

Re: BFS scheduler for N900
 
It would be really cool it this was incorporated into Power kernel. Is it possible to have more than one scheduler in one kernel and doing a switch (not necessarily in runtime but after a reboot maybe).

When n900 is on high load its responsiveness leaves a great deal to be desired. Its even worse when it is overclocked. It sometimes (ie after installing an app in HAM) stalls for 30 or more seconds not responding to any user activity. I would like to test if and how BFS affects that but I really don't want to loose Power kernel features.

coreyoconnor 2010-07-20 16:16

Re: BFS scheduler for N900
 
Agreed. Integrating this patch into the power kernel would be great. I haven't checked out the power kernel patches yet, but I suspect they are largely orthogonal to this patch and should integrate easily.

coreyoconnor 2010-07-27 17:30

Re: BFS for the power kernel
 
I added the voltage scaling patch referenced here:
http://omappedia.org/wiki/Patches_be..._yet_submitted

The debs can be found at:
http://www.tothepowerofdisco.com/downloads/

I am going to try to apply the patches under the "smart reflex fixes" heading next. No idea if these, or even the vp force patch, make any difference at all.

dwaradzyn 2010-07-27 17:37

Re: BFS for the power kernel
 
What about the other way - ask Titan to include BFS into Power Kernel. I do not think forking his job and creating new kernel line is advantageous. He recently corrected fcam-drivers in his kernel. Are you sure you want to maintain separate kernel line?

coreyoconnor 2010-07-27 17:53

Re: BFS for the power kernel
 
This kernel is a branch of the git repository for Titan's kernel. :) So eventual inclusion should be easy.

The biggest reason I haven't been able to even send patches to Titan is that I am a git newbie and my repository is a mess! I'm not really even sure how to spit out patches O_o

Some other reasons tho:
  1. I would like somebody (besides me) to test the kernel.
  2. Preferably create a garage project so people can test changes that haven't been migrated to Titan's.

Um.. I think that's it! Thoughts?

Tiboric 2010-07-27 18:00

Re: BFS for the power kernel
 
will try this now... let you know how I do,

Bratag 2010-07-27 18:02

Re: BFS for the power kernel
 
I will give this a shot and run linpack benchmarks pre/post.

http://www.phoronix.com/scan.php?pag...nchmarks&num=1

For those who have no idea what this is about.

Connor - looks like you have used ver 38 rather than 37 of Titans kernel - is that correct?

Tiboric 2010-07-27 18:14

Re: BFS for the power kernel
 
n900 says incompatible package : how do I install this properly?

also had right click and save-as to download as microb and me laptop both opened as txt documents which is weird.

coreyoconnor 2010-07-27 18:19

Re: BFS for the power kernel
 
Quote:

Originally Posted by Tiboric (Post 766753)
n900 says incompatible package : how do I install this properly?

also had right click and save-as to download as microb and me laptop both opened as txt documents which is weird.

Yowza. That's not right..
I think both are caused by my web serving giving no MIME type for the deb files. My bad. Give me a few minutes hehe

Will post when I've verified as fixed.

Bratag 2010-07-27 18:22

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 766756)
Yowza. That's not right..
I think both are caused by my web serving giving no MIME type for the deb files. My bad. Give me a few minutes hehe

Will post when I've verified as fixed.


Well looks like I may have gotten myself fubared with this release.
Boot loop.


EDIT: Thank God for multiboot. Managed to boot into the stock kernel. Looks like you might need to check your files again CC. Just as a FYI I installed the 4 kernel-power debs and added a boot option to multiboot for the new kernel. Could the problem be the kernel image having the .fiasco extension and the modules dir not.

coreyoconnor 2010-07-27 18:44

Re: BFS for the power kernel
 
I have not used multiboot.

The install process should be identical to the kernel-power install process. I did not modify that part of debian control files.

At least in theory. I will check :-)

Bratag 2010-07-27 18:59

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 766784)
I have not used multiboot.

The install process should be identical to the kernel-power install process. I did not modify that part of debian control files.

At least in theory. I will check :-)

I will be honest I have had nothing but damn issues with multiboot since the new version came out. An trying to tweak it now to see what I can do.

Ok have yet to be able to get this to boot. Sorry CC - will have to try it at some later date when its multiboot compat. Right now I have to work on getting back to a stable maemo env.

coreyoconnor 2010-07-27 21:07

Re: BFS for the power kernel
 
No worries at all!
I'll try out multiboot to see where the packages went wrong.

Sounds like a nice idea: Rapidly switch between kernels. Would make comparison tests easier!

hawaii 2010-07-27 22:19

Re: BFS for the power kernel
 
Installed and working on my test N900.

Will ensure validity of packages and then start benchmarking everything.

jehan 2010-07-27 22:21

Re: BFS for the power kernel
 
Installed and works fine so far ...

jehan 2010-07-28 10:42

Re: BFS for the power kernel
 
I tested the equivalent of the latest kernel-power + BFS (used titan's ideal and default configuration).

I found that video on youtube always flickers if you use firefox mobile. Also the top opera status bar and the buttons located in the bottom left and right in opera start to flicker if you open a location.

coreyoconnor 2010-07-28 15:35

Re: BFS for the power kernel
 
Quote:

Originally Posted by jehan (Post 767599)
I tested the equivalent of the latest kernel-power + BFS (used titan's ideal and default configuration).

I found that video on youtube always flickers if you use firefox mobile. Also the top opera status bar and the buttons located in the bottom left and right in opera start to flicker if you open a location.

Interesting.
I have read that using the BFS scheduler can exacerbate race conditions. I thought it was in the BFS FAQ but now I can't locate where i read this. *shrug*

I'll try firefox and opera out.

While reading the BFS FAQ I noticed that Con recommends a different kernel timer config than this kernel is built with. That might also effect this.

DrWilken 2010-07-28 18:21

Re: BFS for the power kernel
 
It should be fairly easy to change the scheduler *live*... ;)

On any other Linux variant You can change it by using /sys/block/<block-device>/queue/scheduler... ;)

I just had a look:
Code:

N900:~# cat /sys/block/mmcblk0/queue/scheduler
noop [cfq]

So changing to noop scheduler (BFS isn't there by default) can be done using:
Code:

N900:~# echo noop > /sys/block/mmcblk0/queue/scheduler
N900:~# cat /sys/block/mmcblk0/queue/scheduler
[noop] cfq

Wonder why they didn't use the noop scheduler by default.

BTW - I'm using the power kernel (.37).

EDIT - NEVERMIND! :) BFS isn't an I/O scheduler (guess I forgot that somewhere along the road)... I still wonder why CFQ is used instead of noop... ;)

shadowjk 2010-07-28 18:31

Re: BFS for the power kernel
 
Why would they use noop? The N900 doesn't have an SSD, and the flash in it behaves nothing like an SSD. noop is probably not that good of an idea..

Besides, you're talking about disk schedulers while the original poster was talking about the CPU scheduler...

DrWilken 2010-07-28 18:35

Re: BFS for the power kernel
 
Quote:

Originally Posted by shadowjk (Post 768142)
Why would they use noop? The N900 doesn't have an SSD, and the flash in it behaves nothing like an SSD. noop is probably not that good of an idea..

http://en.wikipedia.org/wiki/Noop_scheduler

"NOOP scheduler is best used with solid state devices such as flash memory or in general with devices that do not depend on mechanical movement to access data"

Quote:

Originally Posted by shadowjk (Post 768142)
Besides, you're talking about disk schedulers while the original poster was talking about the CPU scheduler...

That's why I wrote NEVERMIND... ;)

coreyoconnor 2010-07-28 18:36

Re: BFS for the power kernel
 
Quote:

Originally Posted by DrWilken (Post 768129)
EDIT - NEVERMIND! :) BFS isn't an I/O scheduler (guess I forgot that somewhere along the road)... I still wonder why CFQ is used instead of noop... ;)

hehe. No worries!
What advantage is there to using noop?

The popular Android device kernel from http://wiki.cyanogenmod.com uses the BFQ IO scheduler: http://lwn.net/Articles/275978/ I was considering incorporating this patch. Cause, hey, the Android kids presumably liked it for a reason.

DrWilken 2010-07-28 18:50

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 768147)
What advantage is there to using noop?

IF (I don't know) flash devices have their own mechanism for handling read/writes there's no need for CFQ to do it for them.

That's the way SSD's function (AFAIK), but I'm not sure about flash. Maybe shadowjk knows... :)

Lot's of sites mention using noop for flash based drives:

http://stackoverflow.com/questions/1...-i-o-scheduler:
Quote:

... noop is often the best choice for memory-backed block devices (e.g. ramdisks) and other non-rotational media (flash) where trying to reschedule I/O is a waste of resources ...
http://www.redhat.com/docs/wp/perfor...uler-noop.html:
Quote:

... The noop scheduler is suitable for devices where there are no performance penalties for seeks. Examples of such devices are ones that use flash memory...
Google Search... :)

Quote:

Originally Posted by coreyoconnor (Post 768147)
The popular Android device kernel from http://wiki.cyanogenmod.com uses the BFQ IO scheduler: http://lwn.net/Articles/275978/ I was considering incorporating this patch. Cause, hey, the Android kids presumably liked it for a reason.

It's worth a try... ;)

shadowjk 2010-07-29 10:53

Re: BFS for the power kernel
 
Well even the term "seek" is wrong for flash.. And ramdisks behave *completely* differently..

To simplify: when writing, a flash drive behaves alot like a slow harddrive from 1995
when reading, it's more like "seeks are free"..

In other words, "seeks" matter if there's any write activity going on, and there cfq can help a bit What's more, a 256k sequential write can be as slow/fast as a 4k write, depending on the access patterns. Unfortunately no schedulers are flash aware. Yes, some are SSD aware, but SSDs have big friggin ARM processors and heaps of RAM to reorder data so that the weak parts of flash performance is hidden..

DrWilken 2010-07-29 14:03

Re: BFS for the power kernel
 
Quote:

Originally Posted by shadowjk (Post 769009)
SSDs have big friggin ARM processors and heaps of RAM to reorder data so that the weak parts of flash performance is hidden..

I did know that they had buffers/cache (RAM), but I had no idea that SSD's had an onboard CPU... ;)

For anyone interested more info here... :)

erniadeldesktop 2010-07-29 14:20

Re: BFS for the power kernel
 
I just leave this here for who is thinking wat?
don't mind me
http://ck.kolivas.org/patches/bfs/sched-BFS.txt

dwaradzyn 2010-07-29 18:37

Re: BFS for the power kernel
 
I have just installed and tested it. The first thing that I have noticed is that vibration after touching the screen can take be up to 1 second long on high loads. On non-BFS kernels vibration was always very short (and on high load there was no vibration at all as device was not responding at all). I did a test with app manager - and it was certainly better than non-BFS because even with high load and paging I was able to interact with UI. But it was far from smooth. So far it is good. If I find anything interesting I will post here.

shadowjk 2010-07-29 19:11

Re: BFS for the power kernel
 
Quote:

Originally Posted by DrWilken (Post 769243)
I did know that they had buffers/cache (RAM), but I had no idea that SSD's had an onboard CPU... ;)

For anyone interested more info here... :)


Intrestng stuff, but the most crucial:

Quote:

A January 2009 review of the market by technology reviewer Tom's Hardware concluded that comparatively few of the tested devices showed acceptable I/O performance, with several disappointments
and

Quote:

In particular, operations that require many small writes, such as log files, are particularly badly affected on some devices, potentially causing the entire host system to freeze for periods of up to one second at a time.
Sound familiar from the "N900 stutters" threads? :)

Intel needed to add a big ARM processor and megabytes of ram, not for buffer/cache, but for essentially running a log structured filesystem ontop of the raw flash :)

The amount of resources they needed to make it fast all the time wont fit in a SD/mmc for quite some years yet :)

dwaradzyn 2010-07-30 08:18

Re: BFS for the power kernel
 
I have noticed that Opera is heavily influenced by BFS kernel. There is a lot of flickering and UI flashes and it looks buggy as hell. As I use Opera alot and this renders using this browser not very pleasant experience I will switch back to power kernel. This is propably due to bad coding in Opera exposed by BFS. Other software does not seem to be influenced at all.

jehan 2010-07-30 09:50

Re: BFS for the power kernel
 
Quote:

Originally Posted by DrWilken (Post 768129)
Wonder why they didn't use the noop scheduler by default.

Just noticed the SIO scheduler which is included in pf-kernel:
Code:

The Simple I/O scheduler is an extremely simple scheduler,
based on noop and deadline, that relies on deadlines to
ensure fairness. The algorithm does not do any sorting but
basic merging, trying to keep a minimum overhead. It is aimed
mainly for aleatory access devices (eg: flash devices).


DrWilken 2010-07-30 09:53

Re: BFS for the power kernel
 
Quote:

Originally Posted by jehan (Post 770091)
Just noticed the SIO scheduler which is included in pf-kernel:
Code:

The Simple I/O scheduler is an extremely simple scheduler,
based on noop and deadline, that relies on deadlines to
ensure fairness. The algorithm does not do any sorting but
basic merging, trying to keep a minimum overhead. It is aimed
mainly for aleatory access devices (eg: flash devices).


Never heard about SIO... ;) Thanks... :)

coreyoconnor 2010-08-04 15:29

Re: BFS for the power kernel
 
This article mentions some new patches aimed at improving desktop responsiveness: http://www.phoronix.com/scan.php?pag...item&px=ODQ3Mw

I have been super busy lately with other projects but I will try back porting these patches in the next few days.

mooninite 2010-08-04 18:36

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 775538)
This article mentions some new patches aimed at improving desktop responsiveness: http://www.phoronix.com/scan.php?pag...item&px=ODQ3Mw

I have been super busy lately with other projects but I will try back porting these patches in the next few days.

Sounds great! Looking forward to seeing BFS and/or CFQ scheduler fixes for Maemo 5.

iDont 2010-08-27 13:59

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 775538)
This article mentions some new patches aimed at improving desktop responsiveness: http://www.phoronix.com/scan.php?pag...item&px=ODQ3Mw

I have been super busy lately with other projects but I will try back porting these patches in the next few days.

Have you had any luck back porting those patches? They sure look like a worthy addon for the N900 :)

Also, I'm sure you've came across this post too:
Quote:

Originally Posted by Phoronix
Nokia has funded some development work that has resulted in a set of eleven patches for exposing CFS low-latency features.

-Source: http://www.phoronix.com/scan.php?pag...item&px=ODU0OQ

Just a heads-up, not a request ;)

One more question btw: which version of BFS have you incorporated in the kernel-power?
And if possible and time permits, could you try compiling the latest BFS patch with the (if possible, newest) kernel-power?

Keep up the good work, I really like this thread.

-iDont

coreyoconnor 2010-08-29 23:10

Re: BFS for the power kernel
 
Quote:

Originally Posted by iDont (Post 800023)
Have you had any luck back porting those patches? They sure look like a worthy addon for the N900 :)

Also, I'm sure you've came across this post too:

-Source: http://www.phoronix.com/scan.php?pag...item&px=ODU0OQ

Just a heads-up, not a request ;)

I have a test patch for the VM under IO pressure provided here:
http://lkml.org/lkml/2010/8/1/40

However the 2.6.34+ vmscan.c has changed significantly from the 2.6.28 vmscan.c. I think I messed up somewhere cause my patch causes the device to stick in lumpy reclaim mode continuously. Basically makes it unusable as soon as any VM scan operation occurs.

I have been travelling and haven't had a chance to work on any of the newer patches either. but I plan to!

Quote:

Originally Posted by iDont (Post 800023)
One more question btw: which version of BFS have you incorporated in the kernel-power?
And if possible and time permits, could you try compiling the latest BFS patch with the (if possible, newest) kernel-power?

Keep up the good work, I really like this thread.

-iDont


I specifically started with the BFS 316 patch for 2.6.27 here:
http://ck.kolivas.org/patches/bfs/Un...C-2.6.27.patch

Although it contains a few bits and pieces from the 2.6.31 BFS 316 patch - Just because some of the 2.6.27 patch does not apply to 2.6.28.

Course, now that I check I find that BFS is now up to 330.. HMM! Looks like an update is in order.

My code is a proper branch of the kernel-power git tree. First on my list is to make a garage page for this branch.

titan 2010-08-30 06:13

Re: BFS for the power kernel
 
I have no plans to enable BFS in the official kernel-power package as BFS seems to be to unstable and cannot be disabled during runtime.
You could, however, join the kernel-power project and create a git branch for your patches.

Quote:

Originally Posted by coreyoconnor (Post 801798)
My code is a proper branch of the kernel-power git tree. First on my list is to make a garage page for this branch.


coreyoconnor 2010-08-30 13:44

Re: BFS for the power kernel
 
Quote:

Originally Posted by titan (Post 802012)
You could, however, join the kernel-power project and create a git branch for your patches.

I will keep it a separate project. I already create a git branch for these patches.

iDont 2010-08-30 14:32

Re: BFS for the power kernel
 
Quote:

Originally Posted by coreyoconnor (Post 801798)
I have a test patch for the VM under IO pressure provided here:
http://lkml.org/lkml/2010/8/1/40

However the 2.6.34+ vmscan.c has changed significantly from the 2.6.28 vmscan.c. I think I messed up somewhere cause my patch causes the device to stick in lumpy reclaim mode continuously. Basically makes it unusable as soon as any VM scan operation occurs.

I have been travelling and haven't had a chance to work on any of the newer patches either. but I plan to!

Take your time, travelling is great. The fact that somebody is looking into the patches is already good news on its own :)

Quote:

Originally Posted by coreyoconnor (Post 801798)
I specifically started with the BFS 316 patch for 2.6.27 here:
http://ck.kolivas.org/patches/bfs/Un...C-2.6.27.patch

Although it contains a few bits and pieces from the 2.6.31 BFS 316 patch - Just because some of the 2.6.27 patch does not apply to 2.6.28.

Course, now that I check I find that BFS is now up to 330.. HMM! Looks like an update is in order.

My code is a proper branch of the kernel-power git tree. First on my list is to make a garage page for this branch.

Thank you for your time and work on this. I've been using BFS on my single core machines for a while now and, in my opinion, it's also a great addition to the N900. I'm looking forward to see a garage page pop up!

Quote:

Originally Posted by coreyoconnor (Post 802285)
I will keep it a separate project. I already create a git branch for these patches.

FYI, I emailed Titan about this thread. That's probably the reason for his reply in this thread.

Again, keep up the good work, both you and Titan!

-iDont


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

vBulletin® Version 3.8.8