aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/proc.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-06-09 23:03:48 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-06-09 23:03:48 +0000
commit1724c563e62fa8004d74d3aecf8ddcaef0e87cb8 (patch)
tree6ef19e56c607cc5debcc0ca816a3e434323b2d7f /sys/sys/proc.h
parentb4a7ce0690aedd9763b3b47ee7fcdb421f0434c7 (diff)
downloadsrc-1724c563e62fa8004d74d3aecf8ddcaef0e87cb8.tar.gz
src-1724c563e62fa8004d74d3aecf8ddcaef0e87cb8.zip
cred: distribute reference count per thread
This avoids dirtying creds in the common case, see the comment in kern_prot.c for details. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D24007
Notes
Notes: svn path=/head/; revision=361993
Diffstat (limited to 'sys/sys/proc.h')
-rw-r--r--sys/sys/proc.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index fecc422797da..83d0ca1e3a4f 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -267,7 +267,8 @@ struct thread {
struct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */
int td_intr_nesting_level; /* (k) Interrupt recursion. */
int td_pinned; /* (k) Temporary cpu pin count. */
- struct ucred *td_ucred; /* (k) Reference to credentials. */
+ struct ucred *td_realucred; /* (k) Reference to credentials. */
+ struct ucred *td_ucred; /* (k) Used credentials, temporarily switchable. */
struct plimit *td_limit; /* (k) Resource limits. */
int td_slptick; /* (t) Time at sleep. */
int td_blktick; /* (t) Time spent blocked. */
@@ -305,6 +306,7 @@ struct thread {
int td_errno; /* (k) Error from last syscall. */
size_t td_vslock_sz; /* (k) amount of vslock-ed space */
struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */
+ u_int td_ucredref; /* (k) references on td_realucred */
#define td_endzero td_sigmask
/* Copied during fork1() or create_thread(). */