public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Jason Garrett-Glaser <darkshikari@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Kasper Sandberg <lkml@metanurb.dk>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	LKML Mailinglist <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: x264 benchmarks BFS vs CFS
Date: Fri, 18 Dec 2009 13:49:06 +0100	[thread overview]
Message-ID: <1261140546.15591.5.camel@marge.simson.net> (raw)
In-Reply-To: <28f2fcbc0912180211we599252v39cb94d113537eb5@mail.gmail.com>

On Fri, 2009-12-18 at 02:11 -0800, Jason Garrett-Glaser wrote:

> Two more thoughts here:
> 
> 1) We're considering moving to a thread pool soon; we already have a
> working patch for it and if anything it'll save a few clocks spent on
> nice()ing threads and other such things.  Will this improve
> START_DEBIT at all?

Yeah, START_DEBIT only affects a thread once.

>   I've attached the beta patch if you want to try
> it.  Note this also works with 2) as well, so it adds yet another
> dimension to what's mentioned below.
> 
> 2) We recently implemented a new threading model which may be
> interesting to test as well.  This threading model gives worse
> compression *and* performance, but has one benefit: it adds zero
> latency, whereas normal threading adds a full frame of latency per
> thread.  This was paid for by a company interested in
> ultra-low-latency streaming applications, where 1 millisecond is a
> huge deal.  I've been thinking this might be interesting to bench from
> a kernel perspective as well, as when you're spawning a half-dozen
> threads and need them all done within 6 milliseconds, you start
> getting down to serious scheduler issues.
> 
> The new threading model is much less complex than the regular one and
> works as follows.  The frame is split into X slices, and each slice
> encoded with one thread.  Specifically, it works via the following
> process:
> 
> 1.  Preprocess input frame, perform lookahead analysis on input frame
> (all singlethreaded)
> 2.  Split up a ton of threads to do the main encode, one per slice.
> 3.  Join all the threads.
> 4.  Do post-filtering on the output frame, return.
> 
> Clearly this is an utter disaster, since it spawns N times as many
> threads as the old threading model *and* they last far shorter, *and*
> only part of the application is multithreaded.  But there's not really
> a better way to do low-latency threading, and it's an interesting
> challenge to boot.  IIRC, it's also the way ffmpeg's encoder threading
> works.  It's widely considered an inferior model, but as mentioned
> before, in this particular use-case there's no choice.
> 
> To enable this, use --sliced-threads.  I'd recommend using a
> higher-resolution clip for this, as it performs atrociously bad on
> very low resolution videos for reasons you might be able to guess.  If
> you need a higher-res clip, check the SD or HD ones here:
> http://media.xiph.org/video/derf/ .

In another 8 hrs 24 min, I'll have a sunflower to stare at.

> I'm personally curious as to what kind of scheduler issues this
> results in--I haven't done any BFS vs CFS tests with this option
> enabled yet.

I'll look for x264 source, and patch/piddle.

	-Mike


  reply	other threads:[~2009-12-18 12:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17  9:33 x264 benchmarks BFS vs CFS Kasper Sandberg
2009-12-17 10:42 ` Jason Garrett-Glaser
2009-12-17 10:53   ` Ingo Molnar
2009-12-17 11:00     ` Kasper Sandberg
2009-12-17 12:08       ` Ingo Molnar
2009-12-17 12:35         ` Kasper Sandberg
2009-12-17 15:47         ` Arjan van de Ven
2009-12-17 13:30       ` Mike Galbraith
2009-12-18 10:54         ` Kasper Sandberg
2009-12-18 11:41           ` Mike Galbraith
2009-12-17 21:22       ` Thomas Fjellstrom
2009-12-18 10:56         ` Kasper Sandberg
2009-12-18  1:18       ` Jason Garrett-Glaser
2009-12-18  5:23         ` Ingo Molnar
2009-12-18  7:30           ` Mike Galbraith
2009-12-18 10:11             ` Jason Garrett-Glaser
2009-12-18 12:49               ` Mike Galbraith [this message]
2009-12-18 13:06                 ` Ingo Molnar
2009-12-18 13:36                   ` Mike Galbraith
2009-12-18 13:53                 ` Mike Galbraith
2009-12-18 10:57             ` Kasper Sandberg
2009-12-18 11:05               ` Jason Garrett-Glaser
2009-12-19  1:08                 ` Con Kolivas
2009-12-19  4:03                   ` Mike Galbraith
2009-12-19 17:36                     ` Kasper Sandberg
2009-12-19 20:57                       ` Mike Galbraith
2009-12-20  3:22                       ` Andres Freund
2009-12-20 12:10                         ` Kasper Sandberg
2009-12-20 13:09                           ` Kasper Sandberg
2009-12-20 15:13                           ` Mike Galbraith
2009-12-20 15:51                             ` Mike Galbraith
2009-12-22  7:33                               ` Jason Garrett-Glaser
2009-12-22  7:39                                 ` Jason Garrett-Glaser
2009-12-18 10:56         ` Kasper Sandberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1261140546.15591.5.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=darkshikari@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metanurb.dk \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox