]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/PriorityCache: fix over-aggressive assert when mem limited 27763/head
authorMark Nelson <mnelson@redhat.com>
Wed, 24 Apr 2019 15:08:22 +0000 (10:08 -0500)
committerMark Nelson <mnelson@redhat.com>
Wed, 1 May 2019 20:09:47 +0000 (15:09 -0500)
Fixes: https://tracker.ceph.com/issues/39437
Signed-off-by: Mark Nelson <mnelson@redhat.com>
src/common/PriorityCache.cc

index 9ce6905a8d8d139e529cce767a28ae50a32833c8..a12b6807462e6c4464050c6cb8c6610e38b64d9f 100644 (file)
@@ -262,7 +262,13 @@ namespace PriorityCache
     // Each cache is going to get a little extra from get_chunk, so shrink the
     // available memory here to compensate.
     mem_avail -= get_chunk(1, tuned_mem) * caches.size();
-    ceph_assert(mem_avail >= 0);
+
+    if (mem_avail < 0) {
+      // There's so little memory available that just assigning a chunk per
+      // cache pushes us over the limit. Set mem_avail to 0 and continue to
+      // ensure each priority's byte counts are zeroed in balance_priority.
+      mem_avail = 0;
+    }
 
     // Assign memory for each priority level
     for (int i = 0; i < Priority::LAST+1; i++) {