Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

No-Merge [Arm64/Unix] Use sys membarrier #12259

Closed
wants to merge 1 commit into from

Conversation

sdmaclea
Copy link

No description provided.

@sdmaclea
Copy link
Author

This patch is close to what is proposed in #1563.

Initial testing on Arm64/Unix says this is very bad for performance. Total runtime for 11K tests increased 50%.

Kernel spent a lot of time optimizing sys_membarrier to prevent denial of service attacks. So it may simply be slow.

@jkotas @janvorli This patch should not be merged.

@sdmaclea sdmaclea closed this Jun 13, 2017
@@ -167,6 +167,22 @@ check_cxx_symbol_exists(_SC_PHYS_PAGES unistd.h HAVE__SC_PHYS_PAGES)
check_cxx_symbol_exists(_SC_AVPHYS_PAGES unistd.h HAVE__SC_AVPHYS_PAGES)

check_cxx_source_runs("
#include <unistd.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a runtime check. We build our portable dotnet core stuff on RHEL / CentOS 7 where this syscall is not present and we still want it to work on machines that has kernel support for this syscall.

@@ -3035,6 +3039,11 @@ Return
BOOL
InitializeFlushProcessWriteBuffers()
{
#if HAVE_SYS_MEMBARRIER && defined(_ARM64_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I have mentioned before, we should attempt to call the syscall and if it returns ENOSYS, fall back to the original way. We should set a global flag here so that the actual FlushProcessWriteBuffers knows whether to call the syscall or not. And we would also want to enable it for all architectures, not just ARM64.

@janvorli
Copy link
Member

@sdmaclea oh, I've read your comment after reviewing it. This is unfortunate :-(.

@sdmaclea
Copy link
Author

@janvorli It may not be as bad on other architectures. I have not found the arm64 implementation to look at what is done.

The <linux/membarrier.h> header should not be used if you want it cross platform. Also will be per platform defines of __NR_membarrier since it may not be present in headers.

@karelz karelz modified the milestone: 2.1.0 Aug 28, 2017
@sdmaclea sdmaclea deleted the NO-MERGE-Use-sys_membarrier branch December 4, 2017 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants