|
@@ -15,7 +15,7 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
-#include <dmmlib/config.h>
|
|
|
+#include "dmmlib/config.h"
|
|
|
|
|
|
#ifdef WITH_KNOBS
|
|
|
#include "dmmlib/dmmlib.h"
|
|
@@ -74,23 +74,41 @@ void coalesce(freelist_rb_t *raw_block, block_header_t *ptr) {
|
|
|
if(three_blocks_size <= max_coal_size) {
|
|
|
/* Remove the next block from the free list */
|
|
|
REMOVE_FSLLIST(raw_block, next_block);
|
|
|
+
|
|
|
/* Update border pointer if the next block was the border pointer */
|
|
|
if(raw_block->border_ptr == next_block) {
|
|
|
raw_block->border_ptr = previous_block;
|
|
|
}
|
|
|
/* Reset the previous block size */
|
|
|
set_size_and_free(raw_block, previous_block, three_blocks_size);
|
|
|
+
|
|
|
+ /* In a size-ordered list, the previous block should be removed
|
|
|
+ * and added again to the free list, since its size changes. */
|
|
|
+#ifdef SIZE_ORDERED
|
|
|
+ REMOVE_FSLLIST(raw_block, previous_block);
|
|
|
+ ADD_BLOCK(previous_block);
|
|
|
+#endif /* SIZE_ORDERED */
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/* Check if Previous + Current is ok */
|
|
|
if(previous_current_size <= max_coal_size) {
|
|
|
+
|
|
|
/* Update border pointer if the current block was the border pointer */
|
|
|
if(raw_block->border_ptr == ptr) {
|
|
|
raw_block->border_ptr = previous_block;
|
|
|
}
|
|
|
/* Reset the previous block size */
|
|
|
set_size_and_free(raw_block, previous_block, previous_current_size);
|
|
|
+
|
|
|
+ /* In a size-ordered list, the previous block should be removed
|
|
|
+ * and added again to the free list, since its size changes. */
|
|
|
+#ifdef SIZE_ORDERED
|
|
|
+ REMOVE_FSLLIST(raw_block, previous_block);
|
|
|
+ ADD_BLOCK(previous_block);
|
|
|
+#endif /* SIZE_ORDERED */
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|