'\" t .\" Title: __test_and_clear_bit .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Basic C Library Functions .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "__TEST_AND_CLEAR_BIT" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Basic C Library Functions" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" __test_and_clear_bit \- Clear a bit and return its old value .SH "SYNOPSIS" .HP \w'bool\ __test_and_clear_bit('u .BI "bool __test_and_clear_bit(long\ " "nr" ", volatile\ unsigned\ long\ *\ " "addr" ");" .SH "ARGUMENTS" .PP \fInr\fR .RS 4 Bit to clear .RE .PP \fIaddr\fR .RS 4 Address to count from .RE .SH "DESCRIPTION" .PP This operation is non\-atomic and can be reordered\&. If two examples of this operation race, one can appear to succeed but actually fail\&. You must protect multiple accesses with a lock\&. .SH "NOTE" .PP the operation is performed atomically with respect to the local CPU, but not other CPUs\&. Portable code should not rely on this behaviour\&. KVM relies on this behaviour on x86 for modifying memory that is also accessed from a hypervisor on the same CPU if running in a VM: don\*(Aqt change this without also updating arch/x86/kernel/kvm\&.c .SH "COPYRIGHT" .br