Skip to content
Snippets Groups Projects
  1. Feb 06, 2014
    • Tomasz Grabiec's avatar
      java: extract abstraction of isolated application · c0c1ef63
      Tomasz Grabiec authored
      We aim to support running multiple isolated Java applications in one
      JVM. Some work has already been done to isolate system class
      loaders. There is much more to it than that. Isolated applications
      (aka Contexts) do not map 1-1 to class loaders. One context may have
      many different class loaders.
      
      This change extracts context-specific logic to separate classes as a
      base for further additions.
      c0c1ef63
    • Tomasz Grabiec's avatar
      java: print exception thrown from FindClass · 61e56929
      Tomasz Grabiec authored
      env->FindClass() triggers class initialization which may throw
      exceptions. Instead of printing misleading information that the class
      was not found we should print the exception stack-trace.
      61e56929
    • Tomasz Grabiec's avatar
      java: print errors on stderr rather than debug ring. · 0a21c05b
      Tomasz Grabiec authored
      Currently debug messages are not printed on console by default.
      0a21c05b
    • Glauber Costa's avatar
      jvm_balloon: handle explicit unmapping case · fc469b4d
      Glauber Costa authored
      
      The JVM may unmap certain areas of the heap completely, which was confirmed by
      code inspection by Gleb. In that case, the current balloon code will break.
      
      This is because we were deleting the vma from finish_move(), and recreating the
      old mapping implicitly in the process. With this new patch, the tear down of
      the jvm balloon mapping is done by a separate function. Unmapping or evacuating
      the region won't trigger it.
      
      It still needs to communicate to the balloon code that this address is out of
      the balloons list. We do that by calling the page fault handler with an empty
      frame. jvm_balloon_fault will is patched to interpret an empty frame correctly.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      fc469b4d
  2. Feb 02, 2014
  3. Jan 27, 2014
  4. Jan 24, 2014
    • Glauber Costa's avatar
      balloon: fix the double move problem · 4eb7d9c2
      Glauber Costa authored
      
      As we have recently discovered, some parallel GCs will move an object to two
      different locations at times, and later on decide on which one to use. This
      breaks our implementation if the final object is the second one to be copied,
      because by then the original region is already mapped - so we won't fault, and
      the unmapped region will not be the actual balloon, so we will have a bogus
      fault
      
      The core of this solution is to keep all the regions unmapped. Because they had
      only garbage before, we know Java shouldn't read anything from it before it
      writes something new. And when it does that, we declare that to be no longer a
      balloon.
      
      Movement is then split in two phases: the normal phase, and the finish phase.
      In the finish phase we will remove the old VMA and create the new VMA again,
      with heap characteristics.
      
      Special care needs to be taken when "conciliating" the array: because we use
      the difference between first faulting address and original array address to
      calculate how many bytes we are skipping, we need to store that information
      somewhere. We're using an unordered_map (hash) for that. We'll keep track of
      all in-flight ballooned regions and hold the original address of the array.
      
      When we detect movement *from* that region, we know it is the new location
      and update the balloon object with the new address.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      4eb7d9c2
    • Glauber Costa's avatar
      balloon: introduce a conciliation phase · 2b8ceebc
      Glauber Costa authored
      
      This patch introduces a separate operation, "conciliate", that calculates
      the balloon parameters given an arbitrary address
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2b8ceebc
    • Glauber Costa's avatar
      balloon: fix stack-like behavior for balloons · 5d83b36d
      Glauber Costa authored
      
      We should always remove the last balloon we've created. There are two main
      reasons for that:
      
      1) The older balloons are likely to be already in more tenured generations,
      and will move less, whereas younger balloons could be in younger generations.
      So by removing them like a stack, we'll avoid needless moves
      
      2) The probe, when inserted, should stay for as long as we can.
      
      That was always the intended behavior but I made the small mistake of inserting
      them in the wrong order. Fix that.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      5d83b36d
  5. Jan 22, 2014
  6. Jan 20, 2014
  7. Jan 16, 2014
  8. Jan 15, 2014
  9. Jan 10, 2014
    • Glauber Costa's avatar
      jvm: set max_heap to all available memory. · 8ea89c9c
      Glauber Costa authored
      
      We respect -Xmx when instructed by the user, but when that is left blank, we
      set that to be all remaining memory that we have. That is not 100 % perfect
      because the JVM itself will use some memory, but that should be good enough of
      an estimate. Specially given that some of the memory currently in use by OSv
      could be potentially freed in the future should we need it.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      8ea89c9c
    • Glauber Costa's avatar
      jvm_balloon: disable balloon upon jvm memory pressure. · 0034af3f
      Glauber Costa authored
      
      The biggest problem I am seeing with the balloon is that right now the only
      time we call the balloon is when we're seeing memory pressure. If pressure is
      coming from the JVM, we can livelock in quite interesting ways. We need to
      detect that and disable the ballon in those situations, since ballooning when
      the pressure comes from the JVM will only trash our workloads.
      
      It's not yet working reliably, but this is the direction I plan to start from.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      0034af3f
    • Glauber Costa's avatar
      jvm: insert probe · b32a006b
      Glauber Costa authored
      
      To find out which vmas hold the Java heap, we will use a technique that is very
      close to ballooning (in the implementation, it is effectively the same)
      
      What we will do is we will insert a very small element (2 pages), and mark the
      vma where the object is present as containing the JVM heap. Due to the way the
      JVM allocates objects, that will end up in the young generation. As time
      passes, the object will move the same way the balloon moves, and every new vma
      that is seen will be marked as holding the JVM heap.
      
      That mechanism should work for every generational GC, which should encompass
      most of the JDK7 GCs (it not all). It shouldn't work with the G1GC, but that
      debuts at JDK8, and for that we can do something a lot simpler, namely: having
      the JVM to tell us in advance which map areas contain the heap.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      b32a006b
    • Glauber Costa's avatar
      java: memory pressure monitor · 88343714
      Glauber Costa authored
      
      The best possible criteria for deflating balloons is heap pressure: Whenever
      there is pressure in the JVM, we should give back memory so pressure stops.
      
      To accomplish that, we need to somehow tap into the JVM. This patch register
      a MXBean that will send us notifications about collections. We will ignore
      minor collections and act upon major collections by deflating any existing
      balloons.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      88343714
    • Glauber Costa's avatar
      jvm_balloon: control shrinker activation / deactivation · 52cb4738
      Glauber Costa authored
      
      There are restrictions on when and how a shrinker can run. For instance, if we
      have no balloons inflated, there is nothing to deflate (the relaxer should,
      then, be deactivated). Or also, when the JVM fails to allocate memory for an
      extra balloon, it is pointless to keep trying (which would only lead to
      unnecessary spins) until *at least* the next garbage collection phase.
      
      I believe this behavior of activation / deactivation ought to be shrinker
      specific. The reclaiming framework will only provide the infrastructure to do
      so.
      
      In this patch, the JVM Balloon uses that to inform the reclaimer when it makes
      sense for the shrinker or relaxer to be called.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      52cb4738
    • Glauber Costa's avatar
      JVM ballon driver · 9c59e7e8
      Glauber Costa authored
      
      This patch implements the JVM balloon driver, that is responsible for borrowing
      memory from the JVM when OSv is short on memory, and giving it back when we are
      plentiful. It works by allocating a java byte array, and then unmapping a large
      page-aligned region inside it (as big as our size allows).
      
      This array is good to go until the GC decides to move us. When that happens, we
      need to carefuly emulate the memcpy fault and put things back in place.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      9c59e7e8
  10. Jan 02, 2014
  11. Dec 27, 2013
  12. Dec 03, 2013
  13. Nov 25, 2013
  14. Nov 18, 2013
  15. Nov 08, 2013
  16. Nov 04, 2013
  17. Oct 29, 2013
Loading