Roberts-Thomson, James wrote: > I've been trying to investigate an IO performance issue on my machine, as > part of this I've noticed what is (presumably only a cosmetic) issue with > the messages displayed at kernel boot-time. Agree, purely cosmetic. > In the "good old days" (i.e. older 2.6.x kernel versions), one of the many > messages displayed at kernel boot-time was "elevator: using XXX as default > io scheduler", where XXX was one of the IO schedulers (cfq, anticipatory, > deadline, etc) depending on kernel .config at compile time. > > I noticed in 2.6.11, this message has vanished (although this may have > happened in an earlier kernel), and I now get some messages "io scheduler > XXX registered". Unfortunately, the "default" scheduler is no longer > tagged. > > The Bug, however, is that code to tag the default clearly exists in > elevator.c, thus: > > In function "elv_register": > > printk(KERN_INFO "io scheduler %s registered", e->elevator_name); > if (!strcmp(e->elevator_name, chosen_elevator)) > printk(" (default)"); > printk("\n"); > > Some investigation has shown that when this code is called at kernel boot > time with no "elevator=xxx" kernel argument, chosen_elevator is undefined. > The code that defines chosen_elevator (elevator_setup_default) is only > called for the first time AFTER all the compiled in schedulers call > "elv_register". > > However, if "elevator=xxx" is passed as a kernel argument, the code in > elv_register works. Absolutely right. I am afraid, I introduced this bug (which is no worse than the bug I was trying to fix), while I was trying to get the elevator.c to print the default selection info correct, when a user uses "elevator=" boot parameter. Please refer to the attachment, which contains an email, and a patch I sent to Jens the moment I realised the mistake (unfortunately I had no reply from Jens, perhaps he was/is very busy). I acknowledge that it is an ugly fix, for it seems silly to use an extra variable. I could not think of a better idea I am afraid. I strongly believe that while elv_register() is the right place to print info about an elevator that is being registered, elevator_init() perhaps is the right place to print what is the chosen/default elevator. But the catch 22 is that elv_init() is called once for every block device, so I cannot see an easy solution to print just once. I will try to think more about it, and if I could come up with a better idea, I shall inform you and LKML. Thank you. Hari