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

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

Issue 2457473003: tcmalloc: Use futex syscall in SpinLockDelay() for ARM. (Closed)
Patch Set: tcmalloc: Use futex syscall in SpinLockDelay() for ARM. Created 4 years 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
68 have_futex = (sizeof (Atomic32) == sizeof (int) && 64 have_futex = (sizeof (Atomic32) == sizeof (int) &&
69 syscall(__NR_futex, &x, FUTEX_WAKE, 1, 0) >= 0); 65 syscall(__NR_futex, &x, FUTEX_WAKE, 1, 0) >= 0);
70 #endif
71 if (have_futex && 66 if (have_futex &&
72 syscall(__NR_futex, &x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) { 67 syscall(__NR_futex, &x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) {
73 futex_private_flag = 0; 68 futex_private_flag = 0;
74 } 69 }
75 } 70 }
76 } init_module; 71 } init_module;
77 72
78 } // anonymous namespace 73 } // anonymous namespace
79 74
80 75
(...skipping 24 matching lines...) Expand all
105 100
106 void SpinLockWake(volatile Atomic32 *w, bool all) { 101 void SpinLockWake(volatile Atomic32 *w, bool all) {
107 if (have_futex) { 102 if (have_futex) {
108 syscall(__NR_futex, reinterpret_cast<int *>(const_cast<Atomic32 *>(w)), 103 syscall(__NR_futex, reinterpret_cast<int *>(const_cast<Atomic32 *>(w)),
109 FUTEX_WAKE | futex_private_flag, 1, 0); 104 FUTEX_WAKE | futex_private_flag, 1, 0);
110 } 105 }
111 } 106 }
112 107
113 } // namespace internal 108 } // namespace internal
114 } // namespace base 109 } // 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