fix places-GC trigger when a large message is pending

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.
This commit is contained in:
Matthew Flatt 2014-11-12 05:41:13 -07:00
parent 16678aef6a
commit 50a8863169
2 changed files with 4 additions and 1 deletions

View File

@ -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))
@ -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;

View File

@ -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;