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

Side by Side Diff: third_party/tcmalloc/chromium/src/common.cc

Issue 9717009: Try fixing virtual memory regression from new tcmalloc: use old kPageShift and kMaxSize w/ kNumClas… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/tcmalloc/chromium/src/common.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 n = x; 51 n = x;
52 log += shift; 52 log += shift;
53 } 53 }
54 } 54 }
55 ASSERT(n == 1); 55 ASSERT(n == 1);
56 return log; 56 return log;
57 } 57 }
58 58
59 int AlignmentForSize(size_t size) { 59 int AlignmentForSize(size_t size) {
60 int alignment = kAlignment; 60 int alignment = kAlignment;
61 if (size > kMaxSize) { 61 if (size > 2048) {
62 // Cap alignment at kPageSize for large sizes. 62 // Cap alignment at 256 for large sizes.
63 alignment = kPageSize; 63 alignment = 256;
64 } else if (size >= 128) { 64 } else if (size >= 128) {
65 // Space wasted due to alignment is at most 1/8, i.e., 12.5%. 65 // Space wasted due to alignment is at most 1/8, i.e., 12.5%.
66 alignment = (1 << LgFloor(size)) / 8; 66 alignment = (1 << LgFloor(size)) / 8;
67 } else if (size >= 16) { 67 } else if (size >= 16) {
68 // We need an alignment of at least 16 bytes to satisfy 68 // We need an alignment of at least 16 bytes to satisfy
69 // requirements for some SSE types. 69 // requirements for some SSE types.
70 alignment = 16; 70 alignment = 16;
71 } 71 }
72 // Maximum alignment allowed is page size alignment.
73 if (alignment > kPageSize) {
74 alignment = kPageSize;
75 }
76 CHECK_CONDITION(size < 16 || alignment >= 16); 72 CHECK_CONDITION(size < 16 || alignment >= 16);
77 CHECK_CONDITION((alignment & (alignment - 1)) == 0); 73 CHECK_CONDITION((alignment & (alignment - 1)) == 0);
78 return alignment; 74 return alignment;
79 } 75 }
80 76
81 int SizeMap::NumMoveSize(size_t size) { 77 int SizeMap::NumMoveSize(size_t size) {
82 if (size == 0) return 0; 78 if (size == 0) return 0;
83 // Use approx 64k transfers between thread and central caches. 79 // Use approx 64k transfers between thread and central caches.
84 int num = static_cast<int>(64.0 * 1024.0 / size); 80 int num = static_cast<int>(64.0 * 1024.0 / size);
85 if (num < 2) num = 2; 81 if (num < 2) num = 2;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return result; 203 return result;
208 } 204 }
209 205
210 uint64_t metadata_system_bytes() { return metadata_system_bytes_; } 206 uint64_t metadata_system_bytes() { return metadata_system_bytes_; }
211 207
212 void increment_metadata_system_bytes(size_t bytes) { 208 void increment_metadata_system_bytes(size_t bytes) {
213 metadata_system_bytes_ += bytes; 209 metadata_system_bytes_ += bytes;
214 } 210 }
215 211
216 } // namespace tcmalloc 212 } // namespace tcmalloc
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698