Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(393)

Delta Between Two Patch Sets: src/pkg/runtime/mheap.c

Issue 124670043: code review 124670043: runtime: fix deadlock when gctrace (Closed)
Left Patch Set: diff -r 9985ecf9828f87d8887550109060357e2163ab8a https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 7 months ago
Right Patch Set: diff -r 60fa2aa366ab63ad5773c465df92f5ded3bce245 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/malloc.go ('k') | src/pkg/runtime/proc.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Page heap. 5 // Page heap.
6 // 6 //
7 // See malloc.h for overview. 7 // See malloc.h for overview.
8 // 8 //
9 // When a MSpan is in the heap free list, state == MSpanFree 9 // When a MSpan is in the heap free list, state == MSpanFree
10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. 10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span.
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 ········ 612 ········
613 h = &runtime·mheap; 613 h = &runtime·mheap;
614 sumreleased = 0; 614 sumreleased = 0;
615 for(i=0; i < nelem(h->free); i++) 615 for(i=0; i < nelem(h->free); i++)
616 sumreleased += scavengelist(&h->free[i], now, limit); 616 sumreleased += scavengelist(&h->free[i], now, limit);
617 sumreleased += scavengelist(&h->freelarge, now, limit); 617 sumreleased += scavengelist(&h->freelarge, now, limit);
618 618
619 if(runtime·debug.gctrace > 0) { 619 if(runtime·debug.gctrace > 0) {
620 if(sumreleased > 0) 620 if(sumreleased > 0)
621 runtime·printf("scvg%d: %D MB released\n", k, (uint64)su mreleased>>20); 621 runtime·printf("scvg%d: %D MB released\n", k, (uint64)su mreleased>>20);
622 // TODO(dvyukov): these stats are incorrect as we don't subtract stack usage from heap.
623 // But we can't call ReadMemStats on g0 holding locks.
622 runtime·printf("scvg%d: inuse: %D, idle: %D, sys: %D, released: %D, consumed: %D (MB)\n", 624 runtime·printf("scvg%d: inuse: %D, idle: %D, sys: %D, released: %D, consumed: %D (MB)\n",
623 k, mstats.heap_inuse>>20, mstats.heap_idle>>20, mstats.h eap_sys>>20, 625 k, mstats.heap_inuse>>20, mstats.heap_idle>>20, mstats.h eap_sys>>20,
624 mstats.heap_released>>20, (mstats.heap_sys - mstats.heap _released)>>20); 626 mstats.heap_released>>20, (mstats.heap_sys - mstats.heap _released)>>20);
625 } 627 }
626 } 628 }
627 629
628 static void 630 static void
629 scavenge_m(G *gp) 631 scavenge_m(G *gp)
630 { 632 {
631 runtime·lock(&runtime·mheap.lock); 633 runtime·lock(&runtime·mheap.lock);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 runtime·MProf_Free(sp->b, size, freed); 935 runtime·MProf_Free(sp->b, size, freed);
934 runtime·lock(&runtime·mheap.speciallock); 936 runtime·lock(&runtime·mheap.speciallock);
935 runtime·FixAlloc_Free(&runtime·mheap.specialprofilealloc, sp); 937 runtime·FixAlloc_Free(&runtime·mheap.specialprofilealloc, sp);
936 runtime·unlock(&runtime·mheap.speciallock); 938 runtime·unlock(&runtime·mheap.speciallock);
937 return true; 939 return true;
938 default: 940 default:
939 runtime·throw("bad special kind"); 941 runtime·throw("bad special kind");
940 return true; 942 return true;
941 } 943 }
942 } 944 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b