[systemd-devel] [PATCH] readahead: read /usr files last for rotational media, skip /var

Lennart Poettering lennart at poettering.net
Mon Oct 10 16:58:09 PDT 2011


On Fri, 30.09.11 16:26, Paolo Bonzini (bonzini at gnu.org) wrote:

> 
> On 09/30/2011 03:39 PM, Kay Sievers wrote:
> >Sure. I just think that this is not what we really want in the end.
> 
> That I agree with, but good is the enemy of perfect...

Here's my recommendation how to achieve the same effect as of delaying
/usr but without having to hardcode that dir:

find a somewhat useful formula for ordering things on rotating media
that is something between "order strictly by access time" and "order
strictly by location on disk". I mean, if I understand this properly
then what you are noticing there is that some files really make the
"go-always-by-location" rule have an ill effect for you, right?

Such an algorithm could be really easy, window based: i.e. order first
by time, and the go over the list and rearrange accesses within a
certain time-window by the location. Of course how big the window needs
to be is highly dependent on the disk (specifically the seek time), and
we cannot estimate that in advance (and not even the kernel can do this,
since it's too early in the game), however I am sure it shouldn't be too
hard to find a window size that isn't perfect for all cases but pretty
good for most.

That way things will work as expected even if all stuff from / is moved
into /usr. Because think about it: you don't actually ever wanted to
load stuff from /usr later then the stuff from /, instead what you
really wanted to do is load later stuff after earlier stuff.
 
I think a solution like this could probably be implemented in 30 lines
or less. I#d be happy to merge such a patch if it is well done.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list