Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: chromeos/hugepage_text/hugepage_text.cc

Issue 1619713007: Make text section 2MB aligned for hugepages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/hugepage_text/hugepage_text.cc
diff --git a/chromeos/hugepage_text/hugepage_text.cc b/chromeos/hugepage_text/hugepage_text.cc
index ccae53f723fdbd9e181f5421fd82c2fdc851062b..dd2dcf4a572c4ee98a2bcf1342abea06512f1634 100644
--- a/chromeos/hugepage_text/hugepage_text.cc
+++ b/chromeos/hugepage_text/hugepage_text.cc
@@ -172,7 +172,11 @@ static void MremapHugetlbText(void* vaddr, const size_t hsize) {
// Effect: physical backing page changed from small page to hugepage. If there
// are error condition, the remaping operation is aborted.
static void RemapHugetlbText(void* vaddr, const size_t segsize) {
- int hsize = segsize;
+ // remove unaligned head regions
+ size_t head_gap = (kHpageSize - (size_t)addr % kHpageSize) % kHpageSize;
kenchen 2016/01/22 22:19:42 This should vaddr and the last mod operation is no
yunlian 2016/01/22 22:27:00 Yes, the vaddr is part is done. The last mod is us
+ size_t addr = (size_t)vaddr + head_gap;
+
+ int hsize = segsize - head_gap;
if (segsize > kHpageSize * kNumHugePages)
hsize = kHpageSize * kNumHugePages;
hsize = hsize & kHpageMask;
@@ -180,7 +184,7 @@ static void RemapHugetlbText(void* vaddr, const size_t segsize) {
if (hsize == 0)
return;
- MremapHugetlbText(vaddr, hsize);
+ MremapHugetlbText((void *)addr, hsize);
}
// For a given ELF program header descriptor, iterates over all segments within
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698