diff options
author | jhb <jhb@FreeBSD.org> | 2001-08-10 23:00:07 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-08-10 23:00:07 +0000 |
commit | a246c20aae389a5d307ee4f3c3a882beb1388f64 (patch) | |
tree | 2c126aa8065a99016cdde9f028ddbdfec638a7a7 | |
parent | 4a89454dcd75ebc44e557012c2d007934836f9de (diff) | |
download | FreeBSD-src-a246c20aae389a5d307ee4f3c3a882beb1388f64.zip FreeBSD-src-a246c20aae389a5d307ee4f3c3a882beb1388f64.tar.gz |
Add an optimization where we check hte PS_ASTPENDING and PS_NEEDRESCHED
flags with interrupts disabled to see if we should call ast() during
doreti. This was mostly submitted by Bruce, but his original patch did
the looping in ast() in assembly rather than in the ast() function itself.
Once we've actually called into the ast() function, it's cheaper to just
loop inside the function rather than returning from the function,
performing the check, and then calling the function again. However, we
can optimize the first check to avoid calling the function at all.
Other architectures may choose to implement this optimization if they
wish but it is not required for correct operation.
Submitted by: bde
-rw-r--r-- | sys/i386/isa/ipl.s | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/i386/isa/ipl.s b/sys/i386/isa/ipl.s index b28837e4..d429f5a 100644 --- a/sys/i386/isa/ipl.s +++ b/sys/i386/isa/ipl.s @@ -66,6 +66,16 @@ doreti_next: je doreti_exit /* no, defer */ doreti_ast: + /* + * Check for ASTs atomically with returning. Disabling CPU + * interrupts provides sufficient locking evein the SMP case, + * since we will be informed of any new ASTs by an IPI. + */ + cli + movl PCPU(CURPROC),%eax + testl $PS_ASTPENDING | PS_NEEDRESCHED,P_SFLAG(%eax) + je doreti_exit + sti pushl %esp /* pass a pointer to the trapframe */ call ast add $4,%esp |