* Credential management. * * struct ucred objects are rarely allocated but gain and lose references all * the time (e.g., on struct file alloc/dealloc) turning refcount updates into * a significant source of cache-line ping ponging. Common cases are worked * around by modifying thread-local counter instead if the cred to operate on * matches td_realucred. * * The counter is split into 2 pa
| 1850 | * accumulated updates. |
| 1851 | */ |
| 1852 | struct ucred * |
| 1853 | crcowget(struct ucred *cr) |
| 1854 | { |
| 1855 | |
| 1856 | mtx_lock(&cr->cr_mtx); |
| 1857 | KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", |
| 1858 | __func__, cr->cr_users, cr)); |
| 1859 | cr->cr_users++; |
| 1860 | cr->cr_ref++; |
| 1861 | mtx_unlock(&cr->cr_mtx); |
| 1862 | return (cr); |
| 1863 | } |
| 1864 | |
| 1865 | static struct ucred * |
| 1866 | crunuse(struct thread *td) |
no test coverage detected