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

Side by Side Diff: third_party/tcmalloc/chromium/src/base/spinlock_linux-inl.h

Issue 2514973002: Revert of tcmalloc: Use futex syscall in SpinLockDelay() for ARM. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/linux_syscall_support.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) 2009, Google Inc. 1 /* Copyright (c) 2009, 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 static bool have_futex; 55 static bool have_futex;
56 static int futex_private_flag = FUTEX_PRIVATE_FLAG; 56 static int futex_private_flag = FUTEX_PRIVATE_FLAG;
57 57
58 namespace { 58 namespace {
59 static struct InitModule { 59 static struct InitModule {
60 InitModule() { 60 InitModule() {
61 int x = 0; 61 int x = 0;
62 // futexes are ints, so we can use them only when 62 // futexes are ints, so we can use them only when
63 // that's the same size as the lockword_ in SpinLock. 63 // that's the same size as the lockword_ in SpinLock.
64 #ifdef __arm__
65 // ARM linux doesn't support sys_futex1(void*, int, int, struct timespec*);
66 have_futex = 0;
67 #else
64 have_futex = (sizeof (Atomic32) == sizeof (int) && 68 have_futex = (sizeof (Atomic32) == sizeof (int) &&
65 syscall(__NR_futex, &x, FUTEX_WAKE, 1, 0) >= 0); 69 syscall(__NR_futex, &x, FUTEX_WAKE, 1, 0) >= 0);
70 #endif
66 if (have_futex && 71 if (have_futex &&
67 syscall(__NR_futex, &x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) { 72 syscall(__NR_futex, &x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) {
68 futex_private_flag = 0; 73 futex_private_flag = 0;
69 } 74 }
70 } 75 }
71 } init_module; 76 } init_module;
72 77
73 } // anonymous namespace 78 } // anonymous namespace
74 79
75 80
(...skipping 24 matching lines...) Expand all
100 105
101 void SpinLockWake(volatile Atomic32 *w, bool all) { 106 void SpinLockWake(volatile Atomic32 *w, bool all) {
102 if (have_futex) { 107 if (have_futex) {
103 syscall(__NR_futex, reinterpret_cast<int *>(const_cast<Atomic32 *>(w)), 108 syscall(__NR_futex, reinterpret_cast<int *>(const_cast<Atomic32 *>(w)),
104 FUTEX_WAKE | futex_private_flag, 1, 0); 109 FUTEX_WAKE | futex_private_flag, 1, 0);
105 } 110 }
106 } 111 }
107 112
108 } // namespace internal 113 } // namespace internal
109 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/linux_syscall_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698