FreeBSD Bugzilla – Attachment 243025 Details for
Bug 272238
False sharing with pthread rw and spin locks leads to severe perf degradation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to ameliorate false sharing with pthread rw and spin locks.
libthr-false-sharing.diff (text/plain), 1.10 KB, created by
Greg Becker
on 2023-06-26 23:41:16 UTC
(
hide
)
Description:
Patch to ameliorate false sharing with pthread rw and spin locks.
Filename:
MIME Type:
Creator:
Greg Becker
Created:
2023-06-26 23:41:16 UTC
Size:
1.10 KB
patch
obsolete
>diff --git a/lib/libthr/thread/thr_pspinlock.c b/lib/libthr/thread/thr_pspinlock.c >index 089416a18a07..22016efb6211 100644 >--- a/lib/libthr/thread/thr_pspinlock.c >+++ b/lib/libthr/thread/thr_pspinlock.c >@@ -60,7 +60,7 @@ _pthread_spin_init(pthread_spinlock_t *lock, int pshared) > if (lock == NULL) > return (EINVAL); > if (pshared == PTHREAD_PROCESS_PRIVATE) { >- lck = malloc(sizeof(struct pthread_spinlock)); >+ lck = malloc(roundup(sizeof(struct pthread_spinlock), CACHE_LINE_SIZE)); > if (lck == NULL) > return (ENOMEM); > *lock = lck; >diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c >index b7526376a9a3..0f66398989a4 100644 >--- a/lib/libthr/thread/thr_rwlock.c >+++ b/lib/libthr/thread/thr_rwlock.c >@@ -102,7 +102,7 @@ rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) > > if (attr == NULL || *attr == NULL || > (*attr)->pshared == PTHREAD_PROCESS_PRIVATE) { >- prwlock = calloc(1, sizeof(struct pthread_rwlock)); >+ prwlock = calloc(1, roundup(sizeof(struct pthread_rwlock), CACHE_LINE_SIZE)); > if (prwlock == NULL) > return (ENOMEM); > *rwlock = prwlock;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272238
:
243025
|
243029