---
name: "vm_page_assert_sbusied"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/vm_page_assert_sbusied"
---

# vm\_page\_assert\_sbusied(9)

protect page identity changes and page content references

## NAME

**vm\_page\_busied**, **vm\_page\_busy\_downgrade**, **vm\_page\_busy\_sleep**, **vm\_page\_sbusied**, **vm\_page\_sunbusy**, **vm\_page\_trysbusy**, **vm\_page\_tryxbusy**, **vm\_page\_xbusied**, **vm\_page\_xunbusy**, **vm\_page\_assert\_sbusied**, **vm\_page\_assert\_unbusied**, **vm\_page\_assert\_xbusied** – protect page identity changes and page content references

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<vm/vm.h\>**

**#include \<vm/vm\_page.h\>**

*int*\

**vm\_page\_busied**(*vm\_page\_t m*);

*void*\

**vm\_page\_busy\_downgrade**(*vm\_page\_t m*);

*bool*\

**vm\_page\_busy\_sleep**(*vm\_page\_t m*, *const char \*msg*, *int allocflags*);

*int*\

**vm\_page\_sbusied**(*vm\_page\_t m*);

*void*\

**vm\_page\_sunbusy**(*vm\_page\_t m*);

*int*\

**vm\_page\_trysbusy**(*vm\_page\_t m*);

*int*\

**vm\_page\_tryxbusy**(*vm\_page\_t m*);

*int*\

**vm\_page\_xbusied**(*vm\_page\_t m*);

*void*\

**vm\_page\_xunbusy**(*vm\_page\_t m*);

**options INVARIANTS** **options INVARIANT\_SUPPORT**

*void*\

**vm\_page\_assert\_sbusied**(*vm\_page\_t m*);

*void*\

**vm\_page\_assert\_unbusied**(*vm\_page\_t m*);

*void*\

**vm\_page\_assert\_xbusied**(*vm\_page\_t m*);

## DESCRIPTION

Page identity is usually protected by higher level locks like vm\_object locks and vm page locks. However, sometimes it is not possible to hold such locks for the time necessary to complete the identity change. In such case the page can be exclusively busied by a thread which needs to own the identity for a certain amount of time.

In other situations, threads do not need to change the identity of the page but they want to prevent other threads from changing the identity themselves. For example, when a thread wants to access or update page contents without a lock held the page is shared busied.

Before busying a page the vm\_object lock must be held. The same rule applies when a page is unbusied. This makes the vm\_object lock a real busy interlock.

The **vm\_page\_busied**() function returns non-zero if the current thread busied *m* in either exclusive or shared mode. Returns zero otherwise.

The **vm\_page\_busy\_downgrade**() function must be used to downgrade *m* from an exclusive busy state to a shared busy state.

The **vm\_page\_busy\_sleep**() checks the busy state of the page *m* and puts the invoking thread to sleep if the page is busy. The VM object for the page must be locked. The *allocflags* parameter must be either 0, in which case the function will sleep if the page is busied, or VM\_ALLOC\_IGN\_SBUSY, in which case the function will sleep only if the page is exclusively busied. A return value of true indicates that the invoking thread was put to sleep and that the object was unlocked. A return value of false indicates that the invoking thread did not sleep and the object remains locked. The parameter *msg* is a string describing the sleep condition for userland tools.

The **vm\_page\_busied**() function returns non-zero if the current thread busied *m* in shared mode. Returns zero otherwise.

The **vm\_page\_sunbusy**() function shared unbusies *m*.

The **vm\_page\_trysbusy**() attempts to shared busy *m*. If the operation cannot immediately succeed **vm\_page\_trysbusy**() returns 0, otherwise a non-zero value is returned.

The **vm\_page\_tryxbusy**() attempts to exclusive busy *m*. If the operation cannot immediately succeed **vm\_page\_tryxbusy**() returns 0, otherwise a non-zero value is returned.

The **vm\_page\_xbusied**() function returns non-zero if the current thread busied *m* in exclusive mode. Returns zero otherwise.

The **vm\_page\_xunbusy**() function exclusive unbusies *m*. Assertions on the busy state allow kernels compiled with **options INVARIANTS** and **options INVARIANT\_SUPPORT** to panic if they are not respected.

The **vm\_page\_assert\_sbusied**() function panics if *m* is not shared busied.

The **vm\_page\_assert\_unbusied**() function panics if *m* is not unbusied.

The **vm\_page\_assert\_xbusied**() function panics if *m* is not exclusive busied.

## SEE ALSO

[vm\_page\_aflag(9)](/vm_page_aflag/9.md), [vm\_page\_alloc(9)](/vm_page_alloc/9.md), [vm\_page\_deactivate(9)](/vm_page_deactivate/9.md), [vm\_page\_free(9)](/vm_page_free/9.md), [vm\_page\_grab(9)](/vm_page_grab/9.md), [vm\_page\_insert(9)](/vm_page_insert/9.md), [vm\_page\_lookup(9)](/vm_page_lookup/9.md), [vm\_page\_rename(9)](/vm_page_rename/9.md), [VOP\_GETPAGES(9)](/VOP_GETPAGES/9.md)
