svn commit: r358475 - in stable/12/sys: compat/linux kern sys
Konstantin Belousov
kib at FreeBSD.org
Sat Feb 29 21:55:50 UTC 2020
Author: kib
Date: Sat Feb 29 21:55:48 2020
New Revision: 358475
URL: https://svnweb.freebsd.org/changeset/base/358475
Log:
MFC r358251:
Add td_pflags2, yet another thread-private flags word.
Modified:
stable/12/sys/compat/linux/linux_fork.c
stable/12/sys/kern/kern_fork.c
stable/12/sys/kern/kern_kthread.c
stable/12/sys/kern/kern_thr.c
stable/12/sys/sys/proc.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/compat/linux/linux_fork.c
==============================================================================
--- stable/12/sys/compat/linux/linux_fork.c Sat Feb 29 21:50:08 2020 (r358474)
+++ stable/12/sys/compat/linux/linux_fork.c Sat Feb 29 21:55:48 2020 (r358475)
@@ -309,6 +309,7 @@ linux_clone_thread(struct thread *td, struct linux_clo
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+ newtd->td_pflags2 = 0;
bcopy(&td->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
Modified: stable/12/sys/kern/kern_fork.c
==============================================================================
--- stable/12/sys/kern/kern_fork.c Sat Feb 29 21:50:08 2020 (r358474)
+++ stable/12/sys/kern/kern_fork.c Sat Feb 29 21:55:48 2020 (r358475)
@@ -489,6 +489,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct
bzero(&td2->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+ td2->td_pflags2 = 0;
bcopy(&td->td_startcopy, &td2->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
Modified: stable/12/sys/kern/kern_kthread.c
==============================================================================
--- stable/12/sys/kern/kern_kthread.c Sat Feb 29 21:50:08 2020 (r358474)
+++ stable/12/sys/kern/kern_kthread.c Sat Feb 29 21:55:48 2020 (r358475)
@@ -283,6 +283,7 @@ kthread_add(void (*func)(void *), void *arg, struct pr
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+ newtd->td_pflags2 = 0;
bcopy(&oldtd->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
Modified: stable/12/sys/kern/kern_thr.c
==============================================================================
--- stable/12/sys/kern/kern_thr.c Sat Feb 29 21:50:08 2020 (r358474)
+++ stable/12/sys/kern/kern_thr.c Sat Feb 29 21:55:48 2020 (r358475)
@@ -235,6 +235,7 @@ thread_create(struct thread *td, struct rtprio *rtp,
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+ newtd->td_pflags2 = 0;
bcopy(&td->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
newtd->td_proc = td->td_proc;
Modified: stable/12/sys/sys/proc.h
==============================================================================
--- stable/12/sys/sys/proc.h Sat Feb 29 21:50:08 2020 (r358474)
+++ stable/12/sys/sys/proc.h Sat Feb 29 21:55:48 2020 (r358475)
@@ -368,6 +368,7 @@ struct thread {
#ifdef __amd64__
struct mdthread td_md; /* (k) Any machine-dependent fields. */
#endif
+ int td_pflags2; /* (k) Private thread (TDP2_*) flags. */
};
struct thread0_storage {
@@ -1162,6 +1163,25 @@ curthread_pflags_restore(int save)
{
curthread->td_pflags &= save;
+}
+
+static __inline int
+curthread_pflags2_set(int flags)
+{
+ struct thread *td;
+ int save;
+
+ td = curthread;
+ save = ~flags | (td->td_pflags2 & flags);
+ td->td_pflags2 |= flags;
+ return (save);
+}
+
+static __inline void
+curthread_pflags2_restore(int save)
+{
+
+ curthread->td_pflags2 &= save;
}
static __inline __pure2 struct td_sched *
More information about the svn-src-all
mailing list