Skip to contentSkip to conversation

Slow disk access

DISCUSSION Marco Gerards 2 participants 3 messages Feb 4, 2005 – Feb 5, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

The disk access on GRUB 2 is terribly slow. At first I thought it was only a problem on the PPC, but it is also showing up in grub-emu and I guess on the PC as well. You can notice the problem when reading in big files, like a big kernel. Reading in a 20MB files takes 17 seconds.

In this e-mail I will propose some things that could make GRUB work smoother. Some ideas are just plain silly, but I want to address the issue at all levels. If someone has other suggestions, please tell me. This is an important and serious issue we have to deal with. It would also be very nice if someone could test if the problem occurs on the PC as well (when booting that is).

The load time of 17 seconds can be easily be reduced to one or two seconds by increasing GRUB_DISK_CACHE_SIZE from 8 to 128. So that means the problem is that the writes are devices up in too many small reads, I guess. I don't think this is a good solution, but feel free to convince me otherwise. :)

One thing that fshelp does is reading files on behalf of the filesystems. It checks per filesystem block to which disk block it belongs and reads it. What we could change is that the blocks will only be read when they get out of order. So instead of:

1, 2, 3, 6, 7, 10

It should read the blocks like:

1-3, 6-7, 10

This of course does not matter with such small ranges, but it could improve the performance when reading more than GRUB_DISK_CACHE_SIZE.

Which brings me to the next problem: grub_disk_read does just read 8 blocks at a time, not what was requested.

And of course that is not the last problem. Even if the filesystem and disk.c would work in a way multiple blocks would be read, the grub_file_read caller would have to read multiple blocks as well.

So I really hope I am not understanding the problem at all and it is something else. Perhaps I can have a more detailed look at this tomorrow by studying GRUB 2 and GRUB Legacy, to see that does not have the same problems.

I would appreciate if someone who could test big files by booting from a PC to see if the problem was there too. Patches to fix this properly would be better of course, but for that we need to know what to fix. :)

Thanks,
Marco

#1 lore raw
Quoted 5 lines · Marco Gerards

The disk access on GRUB 2 is terribly slow. At first I thought it was only a problem on the PPC, but it is also showing up in grub-emu and I guess on the PC as well. You can notice the problem when reading in big files, like a big kernel. Reading in a 20MB files takes 17 seconds.

I don't see such a problem with grub-emu on PC. I tested the current CVS version. I made a hard disk image with ext2, put a 20MB file on it and run "cat (hd0,0)/foo" with the output of cat disabled (I modified the code). It took about 2 seconds on my laptop. Since my disk is really slow, I think this is normal. I did this test after I "cat" two ISO image files to /dev/null to flush the cache of the hard disk image.

So I guess it is specific to PowerPC.

Okuji

#2 lore raw
Quoted 7 lines · Yoshinori K. Okuji
Quoted 5 lines · Marco Gerards

The disk access on GRUB 2 is terribly slow. At first I thought it was only a problem on the PPC, but it is also showing up in grub-emu and I guess on the PC as well. You can notice the problem when reading in big files, like a big kernel. Reading in a 20MB files takes 17 seconds.

Quoted 6 lines

I don't see such a problem with grub-emu on PC. I tested the current CVS version. I made a hard disk image with ext2, put a 20MB file on it and run "cat (hd0,0)/foo" with the output of cat disabled (I modified the code). It took about 2 seconds on my laptop. Since my disk is really slow, I think this is normal. I did this test after I "cat" two ISO image files to /dev/null to flush the cache of the hard disk image.

Interesting, I will try this too or see how it differs from my test code.

Quoted 1 line

So I guess it is specific to PowerPC.

The grub-emu test was on the PC.

Thanks a lot for testing this. I guess the problem is even more complex than I thought at first.

Thanks,
Marco