[haiku-bugs] Re: [Haiku] #8007: [app_server] fully unresponsive when resizing window of big textfile

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Tue, 08 Nov 2011 00:57:37 -0000

#8007: [app_server] fully unresponsive when resizing window of big textfile
   Reporter:  ttcoder             |      Owner:  axeld
       Type:  bug                 |     Status:  new
   Priority:  normal              |  Milestone:  R1
  Component:  Servers/app_server  |    Version:  R1/Development
 Resolution:                      |   Keywords:
 Blocked By:                      |   Blocking:
Has a Patch:  0                   |   Platform:  All

Comment (by bonefish):

 I examined the analysis a bit further and it actually doesn't seem to be a
 bug in the ports code as such. It looks more like a bad case of priority
 inversion. Since threads with all kinds of different priorities use port
 messaging there's a good chance for this to happen for the involved kernel
 locks. Looking at the scheduling data at around 5.53 s one can see that
 the "Tracker" thread (priority 10) -- which has been waiting for around 62
 ms -- acquires the "ports list" mutex. Since there's a higher priority
 thread running (or ready) at the time it doesn't run for another 0.22 s,
 thus blocking higher priority threads waiting on the same lock during that
 time, most notably the "_input_server_event_loop_" thread (priority 103).

 There's quite a bit of locking ping pong going on afterwards, but I
 believe the core of the issue is that we have a FIFO policy for mutexes
 and other locking primitives but no strategy (e.g. priority boosting) to
 address the priority inversion issue. That also explains why multi-CPU
 machines don't have the problem (the high-priority thread runs on one CPU,
 while the other threads can still be served by another CPU) and why
 decreasing the thread priority to 10 helps as well (all threads using port
 messaging probably have a priority >= 10 and thus still get a fair share
 of the CPU).

 I guess the only good solution is to implement some strategy to counter
 priority inversion.

Ticket URL: <http://dev.haiku-os.org/ticket/8007#comment:15>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: