# US 2022/0035664 A1 · Reverse restartable sequences for lock polling scalability

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0035664 A1
- Document ID: US20220035664A1
- Status: Published application
- Kind: A1
- Application number: 17/503,594
- Filed: 2021-10-18
- Published: 2022-02-03
- Earliest claimed: 2019-09-04
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Michael Tsirkin
- Web page: https://patentgrep.com/patent/US20220035664A1

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/526: {Mutual exclusion algorithms}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An example system includes a memory, at least one processor in communication with the memory, a plurality of threads executing on the at least one processor, and a supervisor. The supervisor is configured to preempt a first thread of the plurality of threads and determine a status of the first thread as either (i) executing in an atomic section or (ii) executing outside of the atomic section. The atomic section is a region of code tagged as atomic, and the atomic section includes instructions that run under a lock. Responsive to determining the status as executing in the atomic section, the supervisor is configured to notify a second thread of the plurality of threads to execute a system call based lock to block execution until the lock is released by the first thread.

## Claims

### Claim 1

A method comprising:
preempting, by a supervisor, a first thread;
determining, by the supervisor, a status of the first thread as one of (i) executing in an atomic section and (ii) executing outside of the atomic section, wherein the atomic section is a region of code tagged as atomic; and
responsive to determining the status as executing in the atomic section, notifying, by the supervisor, a second thread to enter a sleep state after polling.

### Claim 2 (depends on 1)

The method of claim 1, wherein polling includes using a spinlock.

### Claim 3 (depends on 1)

The method of claim 1, wherein the second thread is notified to enter the sleep state after a time interval, and the method further comprising waking-up the second thread.

### Claim 4 (depends on 1)

The method of claim 1, wherein the supervisor handles interrupts.

### Claim 5 (depends on 1)

The method of claim 1, wherein the supervisor preempts the first thread by sending an interrupt.

### Claim 6 (depends on 1)

The method of claim 1, wherein the first thread and the second thread execute on the same processor.

### Claim 7 (depends on 1)

The method of claim 1, wherein the first thread and the second thread execute on different processors.

### Claim 8 (depends on 1)

The method of claim 1, wherein the supervisor notifies the second thread to enter a sleep state after polling for a time interval.

### Claim 9 (depends on 1)

The method of claim 1, wherein each of the plurality of threads includes a respective thread identifier, and wherein a notification from the supervisor includes the respective thread identifier of the thread being preempted.

### Claim 10 (depends on 9)

The method of claim 9, wherein at least one of the first thread and the second thread are configured to compare the thread identifier to the owner identifier.

### Claim 11 (depends on 1)

The method of claim 1, wherein the supervisor sends an interrupt to the second thread.

### Claim 12

A system comprising:
a memory;
at least one processor in communication with the memory;
a plurality of threads executing on the at least one processor; and
a supervisor configured to:
preempt a first thread;
determine a status of the first thread as one of (i) executing in an atomic section and (ii) executing outside of the atomic section, wherein the atomic section is a region of code tagged as atomic; and
responsive to determining the status as executing in the atomic section, notify a second thread to enter a sleep state after polling.

### Claim 13 (depends on 1)

The system of claim 1, wherein polling includes using a spinlock.

### Claim 14 (depends on 1)

The system of claim 1, wherein the second thread is notified to enter the sleep state after a time interval, and the method further comprising waking-up the second thread.

### Claim 15 (depends on 1)

The system of claim 1, wherein the supervisor handles interrupts.

### Claim 16 (depends on 1)

The system of claim 1, wherein the supervisor preempts at least one thread by sending an interrupt.

### Claim 17 (depends on 1)

The system of claim 1, wherein the first thread and the second thread execute on the same processor.

### Claim 18 (depends on 1)

The system of claim 1, wherein the first thread and the second thread execute on different processors.

### Claim 19 (depends on 1)

The system of claim 1, wherein the supervisor notifies the second thread to enter a sleep state after polling for a time interval.

### Claim 20

A non-transitory computer readable medium storing instructions, which when executed by a processor, cause the processor to:
preempt, by a supervisor, a first thread;
determine, by the supervisor, a status of the first thread as one of (i) executing in an atomic section and (ii) executing outside of the atomic section, wherein the atomic section is a region of code tagged as atomic; and
responsive to determining the status as executing in the atomic section, notify, by the supervisor, a second thread to enter a sleep state after polling.
