Skip to content

Commit

Permalink
fix places-GC trigger when a large message is pending
Browse files Browse the repository at this point in the history
A large message that hasn't been delivered can trigger a inter-place
GC. The intent is to force a GC to avoid messages piling up that can
never be delivered, but the GC didn't adjust to a state where messages
stay both undelivered and uncollected, and it would continuosly
trigger GCs. Trigger a GC only if the pending-message size has grown
relative to the previous GC.
  • Loading branch information
mflatt committed Nov 12, 2014
1 parent 16678ae commit 50a8863
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion racket/src/racket/gc2/newgc.c
Expand Up @@ -932,7 +932,7 @@ void GC_check_master_gc_request() {

if (mgc) {
/* check for GC needed due to GC_report_unsent_message_delta(): */
if ((mgc->gen0.current_size + mgc->pending_msg_size) >= mgc->gen0.max_size) {
if ((mgc->gen0.current_size + mgc->pending_msg_size) >= (mgc->gen0.max_size + mgc->prev_pending_msg_size)) {
NewGC *gc = GC_get_GC();

if (!postmaster_and_master_gc(gc))
Expand Down Expand Up @@ -2749,6 +2749,8 @@ static void collect_master(Log_Master_Info *lmi) {
GCVERBOSEprintf(gc, "END MASTER COLLECTION\n");
#endif

MASTERGC->prev_pending_msg_size = MASTERGC->pending_msg_size;

{
int i = 0;
int alive = MASTERGCINFO->alive;
Expand Down
1 change: 1 addition & 0 deletions racket/src/racket/gc2/newgc.h
Expand Up @@ -153,6 +153,7 @@ typedef struct NewGC {
void (*unsafe_allocation_abort)(struct NewGC *);
uintptr_t memory_in_use; /* the amount of memory in use */
uintptr_t pending_msg_size; /* set in master, only */
uintptr_t prev_pending_msg_size; /* set in master, only */

/* blame the child thread infos */
GC_Thread_Info *thread_infos;
Expand Down

0 comments on commit 50a8863

Please sign in to comment.