ruby-changes:63851
From: Aaron <ko1@a...>
Date: Thu, 3 Dec 2020 03:47:30 +0900 (JST)
Subject: [ruby-changes:63851] 51268be7fe (master): When allocating new pages, add them to the end of the linked list
https://git.ruby-lang.org/ruby.git/commit/?id=51268be7fe From 51268be7feace6a6547f8be72d6baf9023b08f2b Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Fri, 23 Oct 2020 16:13:11 -0700 Subject: When allocating new pages, add them to the end of the linked list When we allocate new pages, allocate them on the end of the linked list. Then when we compact we can move things to the head of the list diff --git a/gc.c b/gc.c index a681b0b..306ad0e 100644 --- a/gc.c +++ b/gc.c @@ -1914,7 +1914,7 @@ heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page) https://github.com/ruby/ruby/blob/trunk/gc.c#L1914 /* Adding to eden heap during incremental sweeping is forbidden */ GC_ASSERT(!(heap == heap_eden && heap->sweeping_page)); page->flags.in_tomb = (heap == heap_tomb); - list_add(&heap->pages, &page->page_node); + list_add_tail(&heap->pages, &page->page_node); heap->total_pages++; heap->total_slots += page->total_slots; } @@ -5036,7 +5036,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L5036 do { int free_slots = gc_page_sweep(objspace, heap, sweep_page); - heap->sweeping_page = list_next(&heap->pages, sweep_page, page_node); + heap->sweeping_page = list_next(&heap->pages, sweep_page, page_node); if (sweep_page->final_slots + free_slots == sweep_page->total_slots && heap_pages_freeable_pages > 0 && -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/