summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/alpha/exception.s10
-rw-r--r--sys/alpha/alpha/genassym.c7
-rw-r--r--sys/amd64/amd64/exception.S3
-rw-r--r--sys/amd64/amd64/exception.s3
-rw-r--r--sys/amd64/amd64/fpu.c2
-rw-r--r--sys/amd64/amd64/genassym.c6
-rw-r--r--sys/amd64/amd64/sys_machdep.c2
-rw-r--r--sys/amd64/isa/npx.c2
-rw-r--r--sys/i386/i386/exception.s3
-rw-r--r--sys/i386/i386/genassym.c6
-rw-r--r--sys/i386/i386/sys_machdep.c2
-rw-r--r--sys/i386/isa/npx.c2
-rw-r--r--sys/ia64/ia64/exception.S10
-rw-r--r--sys/ia64/ia64/exception.s10
-rw-r--r--sys/ia64/ia64/genassym.c7
-rw-r--r--sys/kern/kern_clock.c7
-rw-r--r--sys/kern/kern_intr.c2
-rw-r--r--sys/kern/kern_kse.c5
-rw-r--r--sys/kern/kern_sig.c6
-rw-r--r--sys/kern/kern_switch.c2
-rw-r--r--sys/kern/kern_synch.c3
-rw-r--r--sys/kern/kern_thread.c5
-rw-r--r--sys/kern/ksched.c6
-rw-r--r--sys/kern/sched_4bsd.c4
-rw-r--r--sys/kern/sched_ule.c12
-rw-r--r--sys/kern/subr_prof.c10
-rw-r--r--sys/kern/subr_smp.c4
-rw-r--r--sys/kern/subr_trap.c17
-rw-r--r--sys/posix4/ksched.c6
-rw-r--r--sys/powerpc/powerpc/genassym.c7
-rw-r--r--sys/security/mac_lomac/mac_lomac.c2
-rw-r--r--sys/sparc64/sparc64/exception.S8
-rw-r--r--sys/sparc64/sparc64/genassym.c7
-rw-r--r--sys/sys/proc.h7
-rw-r--r--sys/sys/resourcevar.h4
35 files changed, 89 insertions, 110 deletions
diff --git a/sys/alpha/alpha/exception.s b/sys/alpha/alpha/exception.s
index 764d8d0..3359b84 100644
--- a/sys/alpha/alpha/exception.s
+++ b/sys/alpha/alpha/exception.s
@@ -133,9 +133,8 @@
2: ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */
call_pal PAL_OSF1_swpipl
ldq s0, PC_CURTHREAD(pcpup) /* checking for pending asts */
- ldq s1, TD_KSE(s0) /* atomically with returning */
- ldl s1, KE_FLAGS(s1)
- ldiq s2, KEF_ASTPENDING | KEF_NEEDRESCHED
+ ldl s1, TD_FLAGS(s0)
+ ldiq s2, TDF_ASTPENDING | TDF_NEEDRESCHED
and s1, s2
beq s1, 3f
ldiq a0, ALPHA_PSL_IPL_0 /* reenable interrupts */
@@ -278,9 +277,8 @@ Ler1: LDGP(pv)
/* Handle any AST's or resched's. */
1: ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */
call_pal PAL_OSF1_swpipl
- ldq s2, TD_KSE(s0) /* checking for pending asts */
- ldl s2, KE_FLAGS(s2) /* atomically with returning */
- ldiq s3, KEF_ASTPENDING | KEF_NEEDRESCHED
+ ldl s2, TD_FLAGS(s0) /* atomically with returning */
+ ldiq s3, TDF_ASTPENDING | TDF_NEEDRESCHED
and s2, s3
beq s2, 2f
ldiq a0, ALPHA_PSL_IPL_0 /* reenable interrupts */
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c
index 55602c9..d967441 100644
--- a/sys/alpha/alpha/genassym.c
+++ b/sys/alpha/alpha/genassym.c
@@ -78,13 +78,12 @@ ASSYM(MTX_RECURSE, offsetof(struct mtx, mtx_recurse));
ASSYM(MTX_UNOWNED, MTX_UNOWNED);
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
-ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
+ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags));
ASSYM(TD_MD_PCBPADDR, offsetof(struct thread, td_md.md_pcbpaddr));
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index f16f1b1..ce07659 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -280,8 +280,7 @@ doreti_ast:
*/
cli
movl PCPU(CURTHREAD),%eax
- movl TD_KSE(%eax), %eax
- testl $KEF_ASTPENDING | KEF_NEEDRESCHED,KE_FLAGS(%eax)
+ testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%eax)
je doreti_exit
sti
pushl %esp /* pass a pointer to the trapframe */
diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s
index f16f1b1..ce07659 100644
--- a/sys/amd64/amd64/exception.s
+++ b/sys/amd64/amd64/exception.s
@@ -280,8 +280,7 @@ doreti_ast:
*/
cli
movl PCPU(CURTHREAD),%eax
- movl TD_KSE(%eax), %eax
- testl $KEF_ASTPENDING | KEF_NEEDRESCHED,KE_FLAGS(%eax)
+ testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%eax)
je doreti_exit
sti
pushl %esp /* pass a pointer to the trapframe */
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index 661a698..4aa0715 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -260,7 +260,7 @@ npx_intr(dummy)
if (td != NULL) {
td->td_pcb->pcb_flags |= PCB_NPXTRAP;
mtx_lock_spin(&sched_lock);
- td->td_kse->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
}
}
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 92915b6..c487214 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -96,10 +96,8 @@ ASSYM(TD_MD, offsetof(struct thread, td_md));
ASSYM(P_MD, offsetof(struct proc, p_md));
ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt));
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
-
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c
index 4d98979..bd89b74 100644
--- a/sys/amd64/amd64/sys_machdep.c
+++ b/sys/amd64/amd64/sys_machdep.c
@@ -165,7 +165,7 @@ i386_extend_pcb(struct thread *td)
td->td_pcb->pcb_ext = ext;
/* switch to the new TSS after syscall completes */
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
mtx_unlock_spin(&sched_lock);
return 0;
diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c
index 661a698..4aa0715 100644
--- a/sys/amd64/isa/npx.c
+++ b/sys/amd64/isa/npx.c
@@ -260,7 +260,7 @@ npx_intr(dummy)
if (td != NULL) {
td->td_pcb->pcb_flags |= PCB_NPXTRAP;
mtx_lock_spin(&sched_lock);
- td->td_kse->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
}
}
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index f16f1b1..ce07659 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -280,8 +280,7 @@ doreti_ast:
*/
cli
movl PCPU(CURTHREAD),%eax
- movl TD_KSE(%eax), %eax
- testl $KEF_ASTPENDING | KEF_NEEDRESCHED,KE_FLAGS(%eax)
+ testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%eax)
je doreti_exit
sti
pushl %esp /* pass a pointer to the trapframe */
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 92915b6..c487214 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -96,10 +96,8 @@ ASSYM(TD_MD, offsetof(struct thread, td_md));
ASSYM(P_MD, offsetof(struct proc, p_md));
ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt));
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
-
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index 4d98979..bd89b74 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -165,7 +165,7 @@ i386_extend_pcb(struct thread *td)
td->td_pcb->pcb_ext = ext;
/* switch to the new TSS after syscall completes */
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
mtx_unlock_spin(&sched_lock);
return 0;
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 661a698..4aa0715 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -260,7 +260,7 @@ npx_intr(dummy)
if (td != NULL) {
td->td_pcb->pcb_flags |= PCB_NPXTRAP;
mtx_lock_spin(&sched_lock);
- td->td_kse->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
}
}
diff --git a/sys/ia64/ia64/exception.S b/sys/ia64/ia64/exception.S
index f4f4c9f..5a62da0 100644
--- a/sys/ia64/ia64/exception.S
+++ b/sys/ia64/ia64/exception.S
@@ -831,26 +831,24 @@ ENTRY(exception_restore, 0)
add r3=PC_CURTHREAD,r13 // &curthread
;;
ld8 r3=[r3] // curthread
- add r2=(KEF_ASTPENDING|KEF_NEEDRESCHED),r0
+ add r2=(TDF_ASTPENDING|TDF_NEEDRESCHED),r0
;;
}
{ .mmb
- add r3=TD_KSE,r3 // &curthread->td_kse
mov r15=psr // save interrupt enable status
nop 4
;;
}
{ .mmi
- ld8 r3=[r3] // curkse
;;
rsm psr.i // disable interrupts
- add r3=KE_FLAGS,r3 // &curkse->ke_flags
+ add r3=TD_FLAGS,r3 // &curthread->td_flags
;;
}
{ .mmi
- ld4 r14=[r3] // fetch curkse->ke_flags
+ ld4 r14=[r3] // fetch curthread->td_flags
;;
- and r14=r2,r14 // flags & (KEF_ASTPENDING|KEF_NEEDRESCHED)
+ and r14=r2,r14 // flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)
nop 5
;;
}
diff --git a/sys/ia64/ia64/exception.s b/sys/ia64/ia64/exception.s
index f4f4c9f..5a62da0 100644
--- a/sys/ia64/ia64/exception.s
+++ b/sys/ia64/ia64/exception.s
@@ -831,26 +831,24 @@ ENTRY(exception_restore, 0)
add r3=PC_CURTHREAD,r13 // &curthread
;;
ld8 r3=[r3] // curthread
- add r2=(KEF_ASTPENDING|KEF_NEEDRESCHED),r0
+ add r2=(TDF_ASTPENDING|TDF_NEEDRESCHED),r0
;;
}
{ .mmb
- add r3=TD_KSE,r3 // &curthread->td_kse
mov r15=psr // save interrupt enable status
nop 4
;;
}
{ .mmi
- ld8 r3=[r3] // curkse
;;
rsm psr.i // disable interrupts
- add r3=KE_FLAGS,r3 // &curkse->ke_flags
+ add r3=TD_FLAGS,r3 // &curthread->td_flags
;;
}
{ .mmi
- ld4 r14=[r3] // fetch curkse->ke_flags
+ ld4 r14=[r3] // fetch curthread->td_flags
;;
- and r14=r2,r14 // flags & (KEF_ASTPENDING|KEF_NEEDRESCHED)
+ and r14=r2,r14 // flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)
nop 5
;;
}
diff --git a/sys/ia64/ia64/genassym.c b/sys/ia64/ia64/genassym.c
index 4aa349f..158b388 100644
--- a/sys/ia64/ia64/genassym.c
+++ b/sys/ia64/ia64/genassym.c
@@ -82,14 +82,13 @@ ASSYM(MTX_UNOWNED, MTX_UNOWNED);
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
-ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags));
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
+ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index da75813..460d26f 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -174,12 +174,12 @@ hardclock_process(frame)
timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) {
p->p_sflag |= PS_ALRMPEND;
- td->td_kse->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
}
if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) {
p->p_sflag |= PS_PROFPEND;
- td->td_kse->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
}
}
mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
@@ -435,6 +435,7 @@ profclock(frame)
int i;
#endif
+ td = curthread;
if (CLKF_USERMODE(frame)) {
/*
* Came from user mode; CPU was in user state.
@@ -445,7 +446,7 @@ profclock(frame)
td = curthread;
if ((td->td_proc->p_sflag & PS_PROFIL) &&
!(td->td_flags & TDF_UPCALLING))
- addupc_intr(td->td_kse, CLKF_PC(frame), 1);
+ addupc_intr(td, CLKF_PC(frame), 1);
}
#ifdef GPROF
else {
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index bd3d531..5330868 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -400,7 +400,7 @@ ithread_schedule(struct ithd *ithread, int do_switch)
ctd->td_state = TDS_CAN_RUN; /* XXXKSE */
mi_switch();
} else {
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
}
} else {
CTR4(KTR_INTR, "%s: pid %d: it_need %d, state %d",
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index 02812d5..7ec5b57 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -652,8 +652,6 @@ kse_create(struct thread *td, struct kse_create_args *uap)
#endif
mtx_lock_spin(&sched_lock);
kse_link(newke, newkg);
- if (p->p_sflag & PS_NEEDSIGCHK)
- newke->ke_flags |= KEF_ASTPENDING;
/* Add engine */
kse_reassign(newke);
mtx_unlock_spin(&sched_lock);
@@ -1065,8 +1063,7 @@ thread_statclock(int user)
return (-1);
if (user) {
/* Current always do via ast() */
- td->td_kse->ke_flags |= KEF_ASTPENDING; /* XXX TDF_ASTPENDING */
- td->td_flags |= TDF_USTATCLOCK;
+ td->td_flags |= (TDF_USTATCLOCK|TDF_ASTPENDING);
td->td_uuticks++;
} else {
if (td->td_mailbox != NULL)
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 0f53b44..8aaf3d9 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -193,7 +193,7 @@ cursig(struct thread *td)
void
signotify(struct proc *p)
{
- struct kse *ke;
+ struct thread *td;
struct ksegrp *kg;
PROC_LOCK_ASSERT(p, MA_OWNED);
@@ -202,8 +202,8 @@ signotify(struct proc *p)
p->p_sflag |= PS_NEEDSIGCHK;
/* XXXKSE for now punish all KSEs */
FOREACH_KSEGRP_IN_PROC(p, kg) {
- FOREACH_KSE_IN_GROUP(kg, ke) {
- ke->ke_flags |= KEF_ASTPENDING;
+ FOREACH_THREAD_IN_GROUP(kg, td) {
+ td->td_flags |= TDF_ASTPENDING;
}
}
}
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index 5cefb1c..ea4e5ba 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -220,6 +220,8 @@ kse_reassign(struct kse *ke)
kg->kg_last_assigned = td;
td->td_kse = ke;
ke->ke_thread = td;
+ if (td->td_proc->p_sflag & PS_NEEDSIGCHK)
+ td->td_flags |= TDF_ASTPENDING;
sched_add(ke);
CTR2(KTR_RUNQ, "kse_reassign: ke%p -> td%p", ke, td);
return;
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 1c4412e..9a1509f 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -448,7 +448,6 @@ mi_switch(void)
struct bintime new_switchtime;
struct thread *td = curthread; /* XXX */
struct proc *p = td->td_proc; /* XXX */
- struct kse *ke = td->td_kse;
u_int sched_nest;
mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED);
@@ -489,7 +488,7 @@ mi_switch(void)
if (p->p_cpulimit != RLIM_INFINITY &&
p->p_runtime.sec > p->p_cpulimit) {
p->p_sflag |= PS_XCPU;
- ke->ke_flags |= KEF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
}
/*
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 02812d5..7ec5b57 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -652,8 +652,6 @@ kse_create(struct thread *td, struct kse_create_args *uap)
#endif
mtx_lock_spin(&sched_lock);
kse_link(newke, newkg);
- if (p->p_sflag & PS_NEEDSIGCHK)
- newke->ke_flags |= KEF_ASTPENDING;
/* Add engine */
kse_reassign(newke);
mtx_unlock_spin(&sched_lock);
@@ -1065,8 +1063,7 @@ thread_statclock(int user)
return (-1);
if (user) {
/* Current always do via ast() */
- td->td_kse->ke_flags |= KEF_ASTPENDING; /* XXX TDF_ASTPENDING */
- td->td_flags |= TDF_USTATCLOCK;
+ td->td_flags |= (TDF_USTATCLOCK|TDF_ASTPENDING);
td->td_uuticks++;
} else {
if (td->td_mailbox != NULL)
diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c
index ba53cc2..b51b314 100644
--- a/sys/kern/ksched.c
+++ b/sys/kern/ksched.c
@@ -186,7 +186,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
rtp_to_pri(&rtp, kg);
FOREACH_THREAD_IN_GROUP(kg, td) { /* XXXKSE */
if (TD_IS_RUNNING(td)) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
} else if (TD_ON_RUNQ(td)) {
if (td->td_priority > kg->kg_user_pri) {
sched_prio(td, kg->kg_user_pri);
@@ -216,7 +216,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
*/
FOREACH_THREAD_IN_GROUP(kg, td) {
if (TD_IS_RUNNING(td)) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
} else if (TD_ON_RUNQ(td)) {
if (td->td_priority > kg->kg_user_pri) {
sched_prio(td, kg->kg_user_pri);
@@ -242,7 +242,7 @@ int ksched_getscheduler(register_t *ret, struct ksched *ksched, struct thread *t
int ksched_yield(register_t *ret, struct ksched *ksched)
{
mtx_lock_spin(&sched_lock);
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
mtx_unlock_spin(&sched_lock);
return 0;
}
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 325911f..605fcbd 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -123,7 +123,7 @@ maybe_resched(struct thread *td)
mtx_assert(&sched_lock, MA_OWNED);
if (td->td_priority < curthread->td_priority && curthread->td_kse)
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
}
/*
@@ -535,7 +535,7 @@ sched_switchout(struct thread *td)
td->td_lastcpu = ke->ke_oncpu;
td->td_last_kse = ke;
ke->ke_oncpu = NOCPU;
- ke->ke_flags &= ~KEF_NEEDRESCHED;
+ td->td_flags &= ~TDF_NEEDRESCHED;
/*
* At the last moment, if this thread is still marked RUNNING,
* then put it back on the run queue as it has not been suspended
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index b96725b..d6a2910 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -492,7 +492,7 @@ sched_switchout(struct thread *td)
td->td_last_kse = ke;
td->td_lastcpu = ke->ke_oncpu;
ke->ke_oncpu = NOCPU;
- ke->ke_flags &= ~KEF_NEEDRESCHED;
+ td->td_flags &= ~TDF_NEEDRESCHED;
if (TD_IS_RUNNING(td)) {
setrunqueue(td);
@@ -518,7 +518,7 @@ sched_switchin(struct thread *td)
#if SCHED_STRICT_RESCHED
if (td->td_ksegrp->kg_pri_class == PRI_TIMESHARE &&
td->td_priority != td->td_ksegrp->kg_user_pri)
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
#endif
}
@@ -530,7 +530,7 @@ sched_nice(struct ksegrp *kg, int nice)
kg->kg_nice = nice;
sched_priority(kg);
FOREACH_THREAD_IN_GROUP(kg, td) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
}
}
@@ -584,7 +584,7 @@ sched_wakeup(struct thread *td)
setrunqueue(td);
#if SCHED_STRICT_RESCHED
if (td->td_priority < curthread->td_priority)
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
#endif
}
@@ -686,7 +686,7 @@ sched_clock(struct thread *td)
if (nke && nke->ke_thread &&
nke->ke_thread->td_priority < td->td_priority)
- ke->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
#endif
/*
* We used a tick charge it to the ksegrp so that we can compute our
@@ -704,7 +704,7 @@ sched_clock(struct thread *td)
if (ke->ke_slice == 0) {
td->td_priority = sched_priority(kg);
ke->ke_slice = sched_slice(kg);
- ke->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
ke->ke_runq = NULL;
}
}
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index b8cd61e..894309d 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -478,7 +478,7 @@ done2:
* inaccurate.
*/
void
-addupc_intr(struct kse *ke, uintptr_t pc, u_int ticks)
+addupc_intr(struct thread *td, uintptr_t pc, u_int ticks)
{
struct uprof *prof;
caddr_t addr;
@@ -487,7 +487,7 @@ addupc_intr(struct kse *ke, uintptr_t pc, u_int ticks)
if (ticks == 0)
return;
- prof = &ke->ke_proc->p_stats->p_prof;
+ prof = &td->td_proc->p_stats->p_prof;
if (pc < prof->pr_off ||
(i = PC_TO_INDEX(pc, prof)) >= prof->pr_size)
return; /* out of range; ignore */
@@ -497,7 +497,7 @@ addupc_intr(struct kse *ke, uintptr_t pc, u_int ticks)
mtx_lock_spin(&sched_lock);
prof->pr_addr = pc;
prof->pr_ticks = ticks;
- ke->ke_flags |= KEF_OWEUPC | KEF_ASTPENDING ;
+ td->td_flags |= TDF_OWEUPC | TDF_ASTPENDING ;
mtx_unlock_spin(&sched_lock);
}
}
@@ -508,9 +508,9 @@ addupc_intr(struct kse *ke, uintptr_t pc, u_int ticks)
* XXXKSE, don't use kse unless we got sched lock.
*/
void
-addupc_task(struct kse *ke, uintptr_t pc, u_int ticks)
+addupc_task(struct thread *td, uintptr_t pc, u_int ticks)
{
- struct proc *p = ke->ke_proc;
+ struct proc *p = td->td_proc;
struct uprof *prof;
caddr_t addr;
u_int i;
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 7965b78..908d587 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -123,7 +123,7 @@ forward_signal(struct thread *td)
int id;
/*
- * signotify() has already set KEF_ASTPENDING and PS_NEEDSIGCHECK on
+ * signotify() has already set TDF_ASTPENDING and PS_NEEDSIGCHECK on
* this process, so all we need to do is poke it if it is currently
* executing so that it executes ast().
*/
@@ -169,7 +169,7 @@ forward_roundrobin(void)
id = pc->pc_cpumask;
if (id != PCPU_GET(cpumask) && (id & stopped_cpus) == 0 &&
td != pc->pc_idlethread) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
map |= id;
}
}
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 47e8472..7ffb968 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -73,7 +73,6 @@ userret(td, frame, oticks)
u_int oticks;
{
struct proc *p = td->td_proc;
- struct kse *ke = td->td_kse;
CTR3(KTR_SYSC, "userret: thread %p (pid %d, %s)", td, p->p_pid,
p->p_comm);
@@ -83,7 +82,7 @@ userret(td, frame, oticks)
PROC_LOCK(p);
mtx_lock_spin(&sched_lock);
if (SIGPENDING(p) && ((p->p_sflag & PS_NEEDSIGCHK) == 0 ||
- (td->td_kse->ke_flags & KEF_ASTPENDING) == 0))
+ (td->td_flags & TDF_ASTPENDING) == 0))
printf("failed to set signal flags properly for ast()\n");
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p);
@@ -126,7 +125,7 @@ userret(td, frame, oticks)
mtx_lock_spin(&sched_lock);
ticks = td->td_sticks - oticks;
mtx_unlock_spin(&sched_lock);
- addupc_task(ke, TRAPF_PC(frame), (u_int)ticks * psratio);
+ addupc_task(td, TRAPF_PC(frame), (u_int)ticks * psratio);
}
}
@@ -176,16 +175,16 @@ ast(struct trapframe *framep)
mtx_lock_spin(&sched_lock);
ke = td->td_kse;
sticks = td->td_sticks;
- flags = ke->ke_flags;
+ flags = td->td_flags;
sflag = p->p_sflag;
p->p_sflag &= ~(PS_ALRMPEND | PS_NEEDSIGCHK | PS_PROFPEND | PS_XCPU);
#ifdef MAC
p->p_sflag &= ~PS_MACPEND;
#endif
- ke->ke_flags &= ~(KEF_ASTPENDING | KEF_NEEDRESCHED | KEF_OWEUPC);
+ td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDRESCHED | TDF_OWEUPC);
cnt.v_soft++;
prticks = 0;
- if (flags & KEF_OWEUPC && sflag & PS_PROFIL) {
+ if (flags & TDF_OWEUPC && sflag & PS_PROFIL) {
prticks = p->p_stats->p_prof.pr_ticks;
p->p_stats->p_prof.pr_ticks = 0;
}
@@ -200,8 +199,8 @@ ast(struct trapframe *framep)
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
- if (flags & KEF_OWEUPC && sflag & PS_PROFIL)
- addupc_task(ke, p->p_stats->p_prof.pr_addr, prticks);
+ if (flags & TDF_OWEUPC && sflag & PS_PROFIL)
+ addupc_task(td, p->p_stats->p_prof.pr_addr, prticks);
if (sflag & PS_ALRMPEND) {
PROC_LOCK(p);
psignal(p, SIGVTALRM);
@@ -240,7 +239,7 @@ ast(struct trapframe *framep)
if (sflag & PS_MACPEND)
mac_thread_userret(td);
#endif
- if (flags & KEF_NEEDRESCHED) {
+ if (flags & TDF_NEEDRESCHED) {
mtx_lock_spin(&sched_lock);
sched_prio(td, kg->kg_user_pri);
p->p_stats->p_ru.ru_nivcsw++;
diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c
index ba53cc2..b51b314 100644
--- a/sys/posix4/ksched.c
+++ b/sys/posix4/ksched.c
@@ -186,7 +186,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
rtp_to_pri(&rtp, kg);
FOREACH_THREAD_IN_GROUP(kg, td) { /* XXXKSE */
if (TD_IS_RUNNING(td)) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
} else if (TD_ON_RUNQ(td)) {
if (td->td_priority > kg->kg_user_pri) {
sched_prio(td, kg->kg_user_pri);
@@ -216,7 +216,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
*/
FOREACH_THREAD_IN_GROUP(kg, td) {
if (TD_IS_RUNNING(td)) {
- td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ td->td_flags |= TDF_NEEDRESCHED;
} else if (TD_ON_RUNQ(td)) {
if (td->td_priority > kg->kg_user_pri) {
sched_prio(td, kg->kg_user_pri);
@@ -242,7 +242,7 @@ int ksched_getscheduler(register_t *ret, struct ksched *ksched, struct thread *t
int ksched_yield(register_t *ret, struct ksched *ksched)
{
mtx_lock_spin(&sched_lock);
- curthread->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ curthread->td_flags |= TDF_NEEDRESCHED;
mtx_unlock_spin(&sched_lock);
return 0;
}
diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c
index 02ca3d9..68202c3 100644
--- a/sys/powerpc/powerpc/genassym.c
+++ b/sys/powerpc/powerpc/genassym.c
@@ -140,15 +140,14 @@ ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
-ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
+ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c
index 0e796fd..8351c00 100644
--- a/sys/security/mac_lomac/mac_lomac.c
+++ b/sys/security/mac_lomac/mac_lomac.c
@@ -530,7 +530,7 @@ maybe_demote(struct mac_lomac *subjlabel, struct mac_lomac *objlabel,
subj->mac_lomac.ml_rangehigh = objlabel->ml_single;
subj->mac_lomac.ml_flags |= MAC_LOMAC_FLAG_UPDATE;
mtx_lock_spin(&sched_lock);
- curthread->td_kse->ke_flags |= KEF_ASTPENDING;
+ curthread->td_flags |= TDF_ASTPENDING;
curthread->td_proc->p_sflag |= PS_MACPEND;
mtx_unlock_spin(&sched_lock);
subjtext = subjlabeltext = objlabeltext = xxx;
diff --git a/sys/sparc64/sparc64/exception.S b/sys/sparc64/sparc64/exception.S
index 5dfb418..5fa41d3 100644
--- a/sys/sparc64/sparc64/exception.S
+++ b/sys/sparc64/sparc64/exception.S
@@ -2316,10 +2316,10 @@ ENTRY(tl0_ret)
*/
wrpr %g0, PIL_TICK, %pil
ldx [PCPU(CURTHREAD)], %l0
- ldx [%l0 + TD_KSE], %l1
- lduw [%l1 + KE_FLAGS], %l2
- and %l2, KEF_ASTPENDING | KEF_NEEDRESCHED, %l2
- brz,a,pt %l2, 1f
+ lduw [%l0 + TD_FLAGS], %l1
+ set TDF_ASTPENDING | TDF_NEEDRESCHED, %l2
+ and %l1, %l2, %l1
+ brz,a,pt %l1, 1f
nop
/*
diff --git a/sys/sparc64/sparc64/genassym.c b/sys/sparc64/sparc64/genassym.c
index a798d90..2032cd8 100644
--- a/sys/sparc64/sparc64/genassym.c
+++ b/sys/sparc64/sparc64/genassym.c
@@ -220,8 +220,8 @@ ASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
ASSYM(IV_MAX, IV_MAX);
-ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
-ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
+ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
+ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
@@ -235,10 +235,9 @@ ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
ASSYM(RW_SHIFT, RW_SHIFT);
-ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
+ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
-ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index c83ef93..8a18d2c 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -298,6 +298,7 @@ struct thread {
struct ucred *td_ucred; /* (k) Reference to credentials. */
void (*td_switchin)(void); /* (k) Switchin special func. */
struct thread *td_standin; /* (?) Use this for an upcall */
+ u_int td_prticks; /* (?) Profclock hits in sys for user */
struct kse_upcall *td_upcall; /* our upcall structure. */
u_int64_t td_sticks; /* (j) Statclock hits in system mode. */
u_int td_uuticks; /* Statclock hits in user, for UTS */
@@ -345,9 +346,12 @@ struct thread {
#define TDF_UPCALLING 0x000100 /* This thread is doing an upcall. */
#define TDF_ONSLEEPQ 0x000200 /* On the sleep queue. */
#define TDF_INMSLEEP 0x000400 /* Don't recurse in msleep(). */
+#define TDF_ASTPENDING 0x000800 /* Thread has some asynchronous events. */
#define TDF_TIMOFAIL 0x001000 /* Timeout from sleep after we were awake. */
#define TDF_INTERRUPT 0x002000 /* Thread is marked as interrupted. */
#define TDF_USTATCLOCK 0x004000 /* Stat clock hits in userland. */
+#define TDF_OWEUPC 0x008000 /* Owe thread an addupc() call at next AST. */
+#define TDF_NEEDRESCHED 0x010000 /* Process needs to yield. */
#define TDF_DEADLKTREAT 0x800000 /* Lock aquisition - deadlock treatment. */
#define TDI_SUSPENDED 0x0001 /* On suspension queue. */
@@ -437,11 +441,8 @@ struct kse {
};
/* flags kept in ke_flags */
-#define KEF_OWEUPC 0x008000 /* Owe thread an addupc() call at next ast. */
#define KEF_IDLEKSE 0x00004 /* A 'Per CPU idle process'.. has one thread */
#define KEF_USER 0x00200 /* Process is not officially in the kernel */
-#define KEF_ASTPENDING 0x00400 /* KSE has a pending ast. */
-#define KEF_NEEDRESCHED 0x00800 /* Process needs to yield. */
#define KEF_DIDRUN 0x02000 /* KSE actually ran. */
#define KEF_EXIT 0x04000 /* KSE is being killed. */
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index 581c1e7..572b575 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -105,8 +105,8 @@ struct thread;
struct kse;
struct proc;
-void addupc_intr(struct kse *ke, uintptr_t pc, u_int ticks);
-void addupc_task(struct kse *ke, uintptr_t pc, u_int ticks);
+void addupc_intr(struct thread *td, uintptr_t pc, u_int ticks);
+void addupc_task(struct thread *td, uintptr_t pc, u_int ticks);
void calcru(struct proc *p, struct timeval *up, struct timeval *sp,
struct timeval *ip);
int chgproccnt(struct uidinfo *uip, int diff, int max);
OpenPOWER on IntegriCloud