mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2024-11-27 01:50:20 -06:00
4078b7760e
The old barrier implementation was very slow when running on a multi-socket machine (pcmemtest issue 16). The new implementation provides two options: - when blocked, spin on a thread-local flag - when blocked, execute a HLT instruction and wait for a NMI The first option might be faster, but we need to measure it to find out. A new boot command line option is provided to select between the two, with a third setting that uses a mixture of the two.
27 lines
673 B
C
27 lines
673 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (C) 2022 Martin Whitaker.
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "boot.h"
|
|
|
|
#include "cpulocal.h"
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Variables
|
|
//------------------------------------------------------------------------------
|
|
|
|
int local_bytes_used = 0;
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Public Functions
|
|
//------------------------------------------------------------------------------
|
|
|
|
int allocate_local_flag(void)
|
|
{
|
|
if (local_bytes_used == LOCALS_SIZE) {
|
|
return -1;
|
|
}
|
|
return local_bytes_used += sizeof(bool);
|
|
}
|