---
name: "io_uring_unregister_iowq_aff"
section: "3"
platform: "linux"
package: "liburing"
version: "2.15-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/io_uring_unregister_iowq_aff"
---

# io\_uring\_unregister\_iowq\_aff(3)

register async worker CPU affinities

## NAME

io\_uring\_register\_iowq\_aff - register async worker CPU affinities

## SYNOPSIS

```
#include <sched.h>
#include <liburing.h>
```

**int io\_uring\_register\_iowq\_aff(struct io\_uring \****ring***,**                                **size\_t** *cpusz***,**                                **const cpu\_set\_t \****mask***);**

**void io\_uring\_unregister\_iowq\_aff(struct io\_uring \****ring***);**

## DESCRIPTION

The **io\_uring\_prep\_register\_iowq\_aff**(3) function registers a set of CPU affinities to be used by the io\_uring async workers. By default, io\_uring async workers are allowed to run on any CPU in the system. If this function is called with *ring* set to the ring in question and *mask* set to a pointer to a **cpu\_set\_t** value and *cpusz* set to the size of the CPU set, then async workers will only be allowed to run on the CPUs specified in the mask. Existing workers may need to hit a schedule point before they are migrated.

For unregistration, [**io\_uring\_unregister\_iowq\_aff**(3)](/io_uring_unregister_iowq_aff/3.md) may be called to restore CPU affinities to the default.

Applications must define **\_GNU\_SOURCE** to obtain the definition of this helper, as *cpu\_set\_t* will not be defined without it.

## RETURN VALUE

Returns **0** on success, or any of the following values in case of error.

- **-EFAULT**

  The kernel was unable to copy the memory pointer to by *mask* as it was invalid.

- **-ENOMEM**

  The kernel was unable to allocate memory for the new CPU mask.

- **-EINVAL**

  *cpusz* or *mask* was NULL/0, or any other value specified was invalid.

## SEE ALSO

[**io\_uring\_queue\_init**(3)](/io_uring_queue_init/3.md), [**io\_uring\_register**(2)](/io_uring_register/2.md)
