IP Library Granted Patent US 12,299,494
Granted Patent B2
US 12,299,494 · App. 17/947,435 · Granted May 13, 2025

Memory barrier elision for multi-threaded workloads

Inventors: Michael Tsirkin (Westford, MA); Andrea Arcangeli (New York, NY)
Assignee: Red Hat, Inc.
G06F9/5038G06F9/3009G06F9/3851G06F9/5044G06F9/522
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,299,494
App. No.
17/947,435
Granted
May 13, 2025
Kind
B2
Abstract

A system includes a memory, at least one physical processor in communication with the memory, and a plurality of threads executing on the at least one physical processor. A first thread of the plurality of threads is configured to execute a plurality of instructions that includes a restartable sequence. Responsive to a different second thread in communication with the first thread being pre-empted while the first thread is executing the restartable sequence, the first thread is configured to restart the restartable sequence prior to reaching a memory barrier.

Claims (36)

1. A system comprising:

a memory;

a plurality of physical processors in communication with the memory;

a restartable sequence of instructions;

a data structure;

an operating system scheduler;

a file directory; and

a plurality of threads executing on the plurality of physical processors, wherein a first thread of the plurality of threads is configured to:

execute the restartable sequence of instructions, wherein the execution updates the data structure, the operating system scheduler updates a file in the file directory based on a change associated with a second thread of the plurality of threads, and the file includes a status of the second thread and an identification of a physical processor of the plurality of physical processors that the second thread is executing on;

receive a signal incident to the update to the file; and

responsive to receiving the signal, execute a read instruction associated with the restartable sequence of instructions at a particular time, wherein the particular time is based on a status of the first thread, wherein the status of the first thread indicates that the first thread and the second thread are executing on a same physical processor of the plurality of physical processors, or indicates that the first thread and the second thread are executing on different physical processors of the plurality of physical processors.

2. The system of claim 1 , wherein when the status of the first thread indicates that the first thread and the second thread are executing on the same physical processor, the first thread is configured to execute the read instruction within the restartable sequence of instructions without restarting the restartable sequence of instructions.

3. The system of claim 2 , wherein a write memory barrier is omitted when the status of the first thread indicates that the first thread and the second thread are executing on the same physical processor.

4. The system of claim 1 , wherein when the status of the first thread indicates that the first thread and the second thread are executing on the different physical processors, the first thread is configured to execute the read instruction after a write memory barrier by restarting the restartable sequence of instructions.

5. The system of claim 1 , wherein the status of the second thread is one of executing, sleeping, suspended, and in process of being killed.

6. The system of claim 1 , wherein executing a memory barrier takes a predetermined amount of time.

7. The system of claim 1 , wherein the file is a Linux/proc filesystem file that supports a poll system call and the directory has a file for each thread.

8. The system of claim 1 , wherein the first and second threads are both software threads.

9. The system of claim 8 , wherein the first and second threads are executing on different physical processors.

10. The system of claim 8 , wherein the first and second threads are executing on the same physical processor.

11. The system of claim 1 , wherein the second thread is executing on a physical CPU.

12. The system of claim 1 , wherein the second thread is executing on a logical CPU or a virtual CPU.

13. The system of claim 1 , wherein each thread of the plurality of threads registers to receive signals based on file updates from the operating system scheduler.

14. A method executed by a first thread of a plurality of threads executing on a plurality of physical processors comprising:

executing a restartable sequence of instructions, wherein the executing updates a data structure, an operating system scheduler updates a file in a file directory based on a change associated with a second thread of the plurality of threads, the data structure is distinct from the file directory, and the file includes a status of the second thread and an identification of a physical processor of the plurality of physical processors that the second thread is executing on;

receiving a signal incident to the update to the file; and

responsive to receiving the signal, executing a read instruction associated with the restartable sequence of instructions at a particular time, wherein the particular time is based on a status of the first thread, wherein the status of the first thread indicates that the first thread and the second thread are executing on a same physical processor of the plurality of physical processors, or indicates that the first thread and the second thread are executing on different physical processors of the plurality of physical processors.

15. The method of claim 14 , wherein when the status of the first thread indicates that the first thread and the second thread are executing on the different physical processors, the first thread is configured to execute the read instruction after a write memory barrier by restarting the restartable sequence of instructions.

16. The method of claim 14 , wherein the first and second threads are both software threads.

17. The method of claim 14 , wherein the file includes identification of at least two of a physical CPU, a logical CPU, or a virtual CPU.

18. The method of claim 14 , wherein when the status of the first thread indicates that the first thread and the second thread are executing on the same physical processor, the first thread is configured to execute the read instruction within the restartable sequence of instructions without restarting the restartable sequence of instructions.

19. The method of claim 18 , wherein a write memory barrier is omitted when the status of the first thread indicates that the first thread and the second thread are executing on the same physical processor.

20. A non-transitory computer-readable storage medium storing instructions which, when executed by a first thread of a plurality of threads on a processor of a plurality of processors executing the plurality of threads, cause the processor to:

execute a restartable sequence of instructions, wherein the execution updates a data structure, an operating system scheduler updates a file in a file directory based on a change associated with a second thread of the plurality of threads, the data structure is distinct from the file directory, and the file includes a status of the second thread and an identification of a physical processor of the plurality of physical processors that the second thread is executing on;

receive a signal incident to the update to the file; and

responsive to receiving the signal, execute a read instruction associated with the restartable sequence of instructions at a particular time, wherein the particular time is based on a status of the first thread, wherein the status of the first thread indicates that the first thread and the second thread are executing on a same physical processor of the plurality of physical processors, or indicates that the first thread and the second thread are executing on different physical processors of the plurality of physical processors.

Assignments (2)
CHANGE OF NAME Recorded Mar 3, 2026
From: RED HAT, INC.
To: RED HAT, LLC
Reel/Frame 074913/0759 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 19, 2022
From: TSIRKIN, MICHAEL; ARCANGELI, ANDREA
To: RED HAT, INC.
Reel/Frame 061137/0290 →
Continuity (2)
Continuation In Part 16586099 · Sep 27, 2019
Related Publication 20230019377A1 · Jan 19, 2023
References Cited (15)
US 5914874A · Nohara · 1999 [cited by examiner]
US 6510448B1 · Churchyard · 2003 [cited by examiner]
US 6697834B1 · Dice · 2004 [cited by applicant]
US 20040260726A1 · Hrle et al. · 2004 [cited by applicant]
US 20080104595A1 · Kawachiya et al. · 2008 [cited by applicant]
US 20090094582A1 · Craft · 2009 [cited by examiner]
US 20120297394A1 · Allen et al. · 2012 [cited by applicant]
US 20140282564A1 · Almog · 2014 [cited by applicant]
US 20140365734A1 · Bridge · 2014 [cited by applicant]
US 20150160967A1 · Mason · 2015 [cited by applicant]
US 20160188381A1 · Decker · 2016 [cited by examiner]
US 20180239604A1 · Cain et al. · 2018 [cited by applicant]
US 20200104397A1 · Fan et al. · 2020 [cited by applicant]
US 20200192720A1 · Liu · 2020 [cited by applicant]
Dave Dice, Maurice Herlihy, Alex Kohan; “Fast Non-intrusive Memory Reclamation for Highly-Concurrent Data Structures”; Brown University and Oracle Labs, USA; Accessed on or before Jun. 24, 2019; (10 Pages). [cited by applicant]