File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1919#include < fcntl.h>
2020#include < unistd.h>
2121
22+ #include < atomic>
2223#include < cerrno>
2324#include < cstddef>
2425#include < cstdint>
@@ -74,12 +75,14 @@ class Sandbox2Peer : public internal::SandboxPeer {
7475
7576absl::StatusOr<sapi::file_util::fileops::FDCloser> CreateMemFdWithHugePages (
7677 const char * name, uintptr_t flags) {
77- static bool huge_tlb_supported = true ;
78+ static std::atomic< bool > huge_tlb_supported = true ;
7879
7980 if (huge_tlb_supported) {
8081 auto res =
8182 util::CreateMemFd (name, flags | util::kMfdHugeTLB | util::kMfdHuge2Mb );
82- huge_tlb_supported = res.ok ();
83+ if (!res.ok () && errno == EINVAL) {
84+ huge_tlb_supported = false ;
85+ }
8386 return res;
8487 }
8588 return absl::InternalError (" No huge page support." );
You can’t perform that action at this time.
0 commit comments