Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @ 535:4e400c36026f
6783381: NUMA allocator: don't pretouch eden space with UseNUMA
Summary: Moved pretouching to MutableSpace. Also MutableSpace now turns on page interleaving for the region it covers.
Reviewed-by: jmasa, jcoomes
author | iveresov |
---|---|
date | Tue, 27 Jan 2009 18:13:59 -0800 |
parents | 7d7a7c599c17 |
children | 0fbdb4381b99 98cb887364d3 |
comparison
equal
deleted
inserted
replaced
534:5cfd8d19e546 | 535:4e400c36026f |
---|---|
25 | 25 |
26 # include "incls/_precompiled.incl" | 26 # include "incls/_precompiled.incl" |
27 # include "incls/_mutableNUMASpace.cpp.incl" | 27 # include "incls/_mutableNUMASpace.cpp.incl" |
28 | 28 |
29 | 29 |
30 MutableNUMASpace::MutableNUMASpace() { | 30 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { |
31 _lgrp_spaces = new (ResourceObj::C_HEAP) GrowableArray<LGRPSpace*>(0, true); | 31 _lgrp_spaces = new (ResourceObj::C_HEAP) GrowableArray<LGRPSpace*>(0, true); |
32 _page_size = os::vm_page_size(); | 32 _page_size = os::vm_page_size(); |
33 _adaptation_cycles = 0; | 33 _adaptation_cycles = 0; |
34 _samples_count = 0; | 34 _samples_count = 0; |
35 update_layout(true); | 35 update_layout(true); |
219 found = true; | 219 found = true; |
220 break; | 220 break; |
221 } | 221 } |
222 } | 222 } |
223 if (!found) { | 223 if (!found) { |
224 lgrp_spaces()->append(new LGRPSpace(lgrp_ids[i])); | 224 lgrp_spaces()->append(new LGRPSpace(lgrp_ids[i], alignment())); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 // Remove spaces for the removed nodes. | 228 // Remove spaces for the removed nodes. |
229 for (int i = 0; i < lgrp_spaces()->length();) { | 229 for (int i = 0; i < lgrp_spaces()->length();) { |
441 void MutableNUMASpace::select_tails(MemRegion new_region, MemRegion intersection, | 441 void MutableNUMASpace::select_tails(MemRegion new_region, MemRegion intersection, |
442 MemRegion* bottom_region, MemRegion *top_region) { | 442 MemRegion* bottom_region, MemRegion *top_region) { |
443 // Is there bottom? | 443 // Is there bottom? |
444 if (new_region.start() < intersection.start()) { // Yes | 444 if (new_region.start() < intersection.start()) { // Yes |
445 // Try to coalesce small pages into a large one. | 445 // Try to coalesce small pages into a large one. |
446 if (UseLargePages && page_size() >= os::large_page_size()) { | 446 if (UseLargePages && page_size() >= alignment()) { |
447 HeapWord* p = (HeapWord*)round_to((intptr_t) intersection.start(), os::large_page_size()); | 447 HeapWord* p = (HeapWord*)round_to((intptr_t) intersection.start(), alignment()); |
448 if (new_region.contains(p) | 448 if (new_region.contains(p) |
449 && pointer_delta(p, new_region.start(), sizeof(char)) >= os::large_page_size()) { | 449 && pointer_delta(p, new_region.start(), sizeof(char)) >= alignment()) { |
450 if (intersection.contains(p)) { | 450 if (intersection.contains(p)) { |
451 intersection = MemRegion(p, intersection.end()); | 451 intersection = MemRegion(p, intersection.end()); |
452 } else { | 452 } else { |
453 intersection = MemRegion(p, p); | 453 intersection = MemRegion(p, p); |
454 } | 454 } |
460 } | 460 } |
461 | 461 |
462 // Is there top? | 462 // Is there top? |
463 if (intersection.end() < new_region.end()) { // Yes | 463 if (intersection.end() < new_region.end()) { // Yes |
464 // Try to coalesce small pages into a large one. | 464 // Try to coalesce small pages into a large one. |
465 if (UseLargePages && page_size() >= os::large_page_size()) { | 465 if (UseLargePages && page_size() >= alignment()) { |
466 HeapWord* p = (HeapWord*)round_down((intptr_t) intersection.end(), os::large_page_size()); | 466 HeapWord* p = (HeapWord*)round_down((intptr_t) intersection.end(), alignment()); |
467 if (new_region.contains(p) | 467 if (new_region.contains(p) |
468 && pointer_delta(new_region.end(), p, sizeof(char)) >= os::large_page_size()) { | 468 && pointer_delta(new_region.end(), p, sizeof(char)) >= alignment()) { |
469 if (intersection.contains(p)) { | 469 if (intersection.contains(p)) { |
470 intersection = MemRegion(intersection.start(), p); | 470 intersection = MemRegion(intersection.start(), p); |
471 } else { | 471 } else { |
472 intersection = MemRegion(p, p); | 472 intersection = MemRegion(p, p); |
473 } | 473 } |
502 } else | 502 } else |
503 if (intersection->contains(invalid_region)) { | 503 if (intersection->contains(invalid_region)) { |
504 // That's the only case we have to make an additional bias_region() call. | 504 // That's the only case we have to make an additional bias_region() call. |
505 HeapWord* start = invalid_region->start(); | 505 HeapWord* start = invalid_region->start(); |
506 HeapWord* end = invalid_region->end(); | 506 HeapWord* end = invalid_region->end(); |
507 if (UseLargePages && page_size() >= os::large_page_size()) { | 507 if (UseLargePages && page_size() >= alignment()) { |
508 HeapWord *p = (HeapWord*)round_down((intptr_t) start, os::large_page_size()); | 508 HeapWord *p = (HeapWord*)round_down((intptr_t) start, alignment()); |
509 if (new_region.contains(p)) { | 509 if (new_region.contains(p)) { |
510 start = p; | 510 start = p; |
511 } | 511 } |
512 p = (HeapWord*)round_to((intptr_t) end, os::large_page_size()); | 512 p = (HeapWord*)round_to((intptr_t) end, alignment()); |
513 if (new_region.contains(end)) { | 513 if (new_region.contains(end)) { |
514 end = p; | 514 end = p; |
515 } | 515 } |
516 } | 516 } |
517 if (intersection->start() > start) { | 517 if (intersection->start() > start) { |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 void MutableNUMASpace::initialize(MemRegion mr, | 527 void MutableNUMASpace::initialize(MemRegion mr, |
528 bool clear_space, | 528 bool clear_space, |
529 bool mangle_space) { | 529 bool mangle_space, |
530 bool setup_pages) { | |
530 assert(clear_space, "Reallocation will destory data!"); | 531 assert(clear_space, "Reallocation will destory data!"); |
531 assert(lgrp_spaces()->length() > 0, "There should be at least one space"); | 532 assert(lgrp_spaces()->length() > 0, "There should be at least one space"); |
532 | 533 |
533 MemRegion old_region = region(), new_region; | 534 MemRegion old_region = region(), new_region; |
534 set_bottom(mr.start()); | 535 set_bottom(mr.start()); |
536 // Must always clear the space | 537 // Must always clear the space |
537 clear(SpaceDecorator::DontMangle); | 538 clear(SpaceDecorator::DontMangle); |
538 | 539 |
539 // Compute chunk sizes | 540 // Compute chunk sizes |
540 size_t prev_page_size = page_size(); | 541 size_t prev_page_size = page_size(); |
541 set_page_size(UseLargePages ? os::large_page_size() : os::vm_page_size()); | 542 set_page_size(UseLargePages ? alignment() : os::vm_page_size()); |
542 HeapWord* rounded_bottom = (HeapWord*)round_to((intptr_t) bottom(), page_size()); | 543 HeapWord* rounded_bottom = (HeapWord*)round_to((intptr_t) bottom(), page_size()); |
543 HeapWord* rounded_end = (HeapWord*)round_down((intptr_t) end(), page_size()); | 544 HeapWord* rounded_end = (HeapWord*)round_down((intptr_t) end(), page_size()); |
544 size_t base_space_size_pages = pointer_delta(rounded_end, rounded_bottom, sizeof(char)) / page_size(); | 545 size_t base_space_size_pages = pointer_delta(rounded_end, rounded_bottom, sizeof(char)) / page_size(); |
545 | 546 |
546 // Try small pages if the chunk size is too small | 547 // Try small pages if the chunk size is too small |
664 bias_region(bottom_region, ls->lgrp_id()); | 665 bias_region(bottom_region, ls->lgrp_id()); |
665 bias_region(top_region, ls->lgrp_id()); | 666 bias_region(top_region, ls->lgrp_id()); |
666 } | 667 } |
667 | 668 |
668 // Clear space (set top = bottom) but never mangle. | 669 // Clear space (set top = bottom) but never mangle. |
669 s->initialize(new_region, SpaceDecorator::Clear, SpaceDecorator::DontMangle); | 670 s->initialize(new_region, SpaceDecorator::Clear, SpaceDecorator::DontMangle, MutableSpace::DontSetupPages); |
670 | 671 |
671 set_adaptation_cycles(samples_count()); | 672 set_adaptation_cycles(samples_count()); |
672 } | 673 } |
673 } | 674 } |
674 | 675 |