Skip to content
Snippets Groups Projects
  1. Jun 01, 2014
  2. May 30, 2014
  3. May 29, 2014
    • Tomasz Grabiec's avatar
      poll: special case POLLIN on one file descriptor · de7d4d92
      Tomasz Grabiec authored
      
      OpenJDK's SocketInputStream.read() is calling poll() to support
      timeout. The call site looks like this:
      
       pfd.fd = s;
       pfd.events = POLLIN | POLLERR;
       poll(&pfd, 1, timeout);
      
      Our current implementation of poll() is quite complex because it needs
      to handle polling on many files. It also allocates memory in several
      places:
       - in poll() due to std::vector
       - in poll_install()
       - in net_channel::add_poller
       - in net_channel::del_poller
      
      poll() on one socket can be greatly simplified and we can avoid memory
      allocation completely. This change adds special casing for that. It
      reduces allocation rate in half in tomcat benchmark with 256 connections.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      de7d4d92
    • Nadav Har'El's avatar
      sched: remove a bit of dead code. · 69dbf7db
      Nadav Har'El authored
      
      Before commit 202b2ccc, the scheduler
      was responsible for saving the FPU state, so we needed to know whether
      the scheduler itself uses it or not. Now that the FPU state is always
      saved at interrupt time, we no longer care whether or not the scheduler
      uses the FPU, so we can drop this flag.
      
      Also drop the optional "pseudo-float" (integer-based floating point
      operations) support from the scheduler. This never had any real
      advantage over the actual floating point, and now that we save the
      FPU state unconditionally, it makes even less sense to avoid floating
      point.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      69dbf7db
    • Nadav Har'El's avatar
      sched: remove unnecessary reschedule_from_interrupt() parameter. · 5f5b6144
      Nadav Har'El authored
      
      Before commit 202b2ccc,
      cpu::reschedule_from_interrupt() needed to know whether we were called
      from an interrupt (preempt=true) or as an ordinary function (preempt=false),
      to know whether or not to save the FPU state.
      
      As we now save the FPU state at the interrupt code,
      reschedule_from_interrupt() no longer needs to deal with this, and so this
      patch removes the unneeded paramter "preempt" to that function.
      
      One thing we are losing in this patch is the "sched_preempt" tracepoint,
      which we previously had when an interrupt caused an actual context switch
      (not just a reschedule call, but actually switching to a different thread).
      We still have the "sched_switch" tracepoint which traces all the context
      switches, which is probably more interesting anyway.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      5f5b6144
  4. May 28, 2014
  5. May 27, 2014
  6. May 26, 2014
  7. May 23, 2014
  8. May 22, 2014
  9. May 21, 2014
  10. May 19, 2014
    • Tomasz Grabiec's avatar
      sched: strengthen the fence in migrate_disable() · 4dbcc248
      Tomasz Grabiec authored
      
      memory_order_acquire does not prevent previous stores from moving past
      the barrier so if the _migration_lock_counter incrementation is split
      into two accesses, this is eligible:
      
      tmp = _migration_lock_counter;
      atomic_signal_fence(std::memory_order_acquire); // load-load, load-store
      <critical instructions here>
      _migration_lock_counter = tmp + 1; // was moved past the barrier
      
      To prevent this, we need to order previous stores with future
      loads and stores, which is given only by std::memory_order_seq_cst.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      4dbcc248
  11. May 18, 2014
  12. May 16, 2014
    • Nadav Har'El's avatar
      sched: high-resolution thread::current()->thread_clock() · c4ebb11a
      Nadav Har'El authored
      
      thread::current()->thread_clock() returns the CPU time consumed by this
      thread. A thread that wishes to measure the amount of CPU time consumed
      by some short section of code will want this clock to have high resolution,
      but in the existing code it was only updated on context switches, so shorter
      durations could not be measured with it.
      
      This patch fixes thread_clock() to also add the time that passed since
      the the time slice started.
      
      When running thread_clock() on *another* thread (not thread::current()),
      we still return a cpu time snapshot from the last context switch - even
      if the thread happens to be running now (on another CPU). Fixing that case
      is quite difficult (and will probably require additional memory-ordering
      guarantees), and anyway not very important: Usually we don't need a
      high-resolution estimate of a different thread's cpu time.
      
      Fixes #302.
      
      Reviewed-by: default avatarGleb Natapov <gleb@cloudius-systems.com>
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      c4ebb11a
    • Glauber Costa's avatar
      sched: make preempt functions inline · 97f5c29d
      Glauber Costa authored
      
      Again, we are currently calling a function everytime we disable/enable preemption
      (actually a pair of functions), where simple mov instructions would do.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      97f5c29d
    • Glauber Costa's avatar
      sched: make current inline · 19b9d16f
      Glauber Costa authored
      
      We are heavily using this function to grab the address of the current thread.
      That means a function call will be issued every time that is done, where a
      simple mov instruction would do.
      
      For objects outside the main ELF, we don't want that to be inlined, since that
      would mean the resolution would have to go through an expensive __tls_get_addr.
      So what we do is that we don't present the symbol as inline for them, and make
      sure the symbol is always generated.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      19b9d16f
  13. May 15, 2014
Loading