Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 1998 08:31:39 -0600 (CST)
From:      Kevin Day <toasty@home.dragondata.com>
To:        hackers@FreeBSD.ORG
Subject:   Nonblocking page fetching
Message-ID:  <199812041431.IAA27124@home.dragondata.com>

next in thread | raw e-mail | index | archive | help

I have an application where I'm streaming large amounts of data from disk,
and throwing it on the screen. (Playing a movie, essentially). I'm mmapping
the region that i'm playing, and just start memcpy'ing each frame into the
renderer's buffer. This is very time critical, so running out of buffered
data isn't good.

I needed a way to trick the kernel into bringing pages off of disk without
making my process block waiting for them. Essentially, if I'm playing frame
10, I'd better already have frames 10-15 in ram, and should start bringing
frame 16 in, while 10 is playing. (I tried keeping a 4-6 frame buffer)


The hack I ended up using was another process that I could tell that I
needed the frames, and all it did was sit in a for loop touching every page,
to force them to be brought in.

This has some obvious disadvantages, but it stopped my movie player from
sitting in vmwait when it could be doing other things.

What would be very nice is a syscall that could tell the vm system that a
page will be needed shortly, so bring it in as soon as possible. Sort of
like madvising with WILL_NEED, but a much stronger hint.

Before I start meddling in things I don't understand (the vm system), does
anyone have any suggestions/comments? If I'm going to do it, i'd like to do
it the correct way so that perhaps others would want to use it as well.


One final note... Does anyone know what effect turning off the bzero on new
pages would be? Security is not an issue in this system, as it's not
connected to the net, and all software running on it I wrote. I go through a
lot of ram, and if I could save some time by not zeroing things, it'd be
great.

Kevin


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812041431.IAA27124>