After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 345720 - Bad performance playing files off CD
Bad performance playing files off CD
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal blocker
: 0.10.9
Assigned To: Jan Schmidt
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-23 07:06 UTC by Jan Schmidt
Modified: 2006-07-04 09:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't MADV_SEQUENTIAL. Touch each page when reading. (2.14 KB, patch)
2006-06-23 07:08 UTC, Jan Schmidt
reviewed Details | Review
new patch. (3.14 KB, patch)
2006-06-23 10:18 UTC, Jan Schmidt
none Details | Review

Description Jan Schmidt 2006-06-23 07:06:55 UTC
I'm seeing really bad playback of an AVI file directly off CD. I think it is caused by the access pattern that results. Buffers are delivered to avidemux, which does subbuffering and puts things in queues.

A while later, the audio and video decoder start accessing those pages. This means that now avidemux and the audio/video decoders are trying to access pages in quite different locations. Unfortunately, filesrc specified (using madvise) that we'd be doing sequential access, so the kernel is being forced to page-in things it already threw away.

Turning off MADV_SEQUENTIAL and touching each page to read it in immediately improves things greatly. Attaching a patch.
Comment 1 Jan Schmidt 2006-06-23 07:08:35 UTC
Created attachment 67878 [details] [review]
Don't MADV_SEQUENTIAL. Touch each page when reading.
Comment 2 Wim Taymans 2006-06-23 08:33:37 UTC
filesrc has a "touch" property that suposedly pages in each page.
What about a property to turn off the sequential hint?
Comment 3 Jan Schmidt 2006-06-23 08:59:38 UTC
Oh, so it does.

I think the sequential hint should be off by default, possibly with a property to turn it _on_. We only want to turn it on for specific access patterns though, otherwise it's going to cause pathological access patterns, since the kernel will flush pages as soon as downstream touches a later one. There's no way to know which behaviour downstream is going to have. simple mp3 files are going to be sequentially access, but every muxed format probably won't.

Comment 4 Jan Schmidt 2006-06-23 09:01:24 UTC
Also, touch should possibly be on by default.
Comment 5 Jan Schmidt 2006-06-23 10:18:18 UTC
Created attachment 67888 [details] [review]
new patch. 

Adds 'sequential' property to filesrc, disabled by default. Turns on TOUCH by default, but might leave that part out.
Comment 6 Jan Schmidt 2006-07-04 09:02:52 UTC
        * plugins/elements/gstfilesrc.c: (gst_file_src_class_init),
        (gst_file_src_init), (gst_file_src_set_property),
        (gst_file_src_get_property), (gst_file_src_map_region):
        * plugins/elements/gstfilesrc.h:
        Add "sequential" property, off by default, to use madvise and hint
        to the kernel that sequential access is desired.
        Touch all retrieved pages by default to ensure they are pulled
        into memory. (Closes #345720)