git: ebb3cb61958d - main - eventtimer: Pass a pcpu state pointer to getnext(cpu)event()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Jul 2022 19:59:02 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ebb3cb61958da8bcc3c28ec3b20dc3a6b8168952 commit ebb3cb61958da8bcc3c28ec3b20dc3a6b8168952 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-07-11 19:38:43 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-07-11 19:58:43 +0000 eventtimer: Pass a pcpu state pointer to getnext(cpu)event() Callers have already loaded the pointer, so these functions don't need to fetch it again. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_clocksource.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index 48e06ee082fc..9d53d1242482 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -65,8 +65,9 @@ static int doconfigtimer(void); static void configtimer(int start); static int round_freq(struct eventtimer *et, int freq); -static sbintime_t getnextcpuevent(int idle); -static sbintime_t getnextevent(void); +struct pcpu_state; +static sbintime_t getnextcpuevent(struct pcpu_state *state, int idle); +static sbintime_t getnextevent(struct pcpu_state *state); static int handleevents(sbintime_t now, int fake); static struct mtx et_hw_mtx; @@ -213,7 +214,7 @@ handleevents(sbintime_t now, int fake) callout_process(now); } - t = getnextcpuevent(0); + t = getnextcpuevent(state, 0); ET_HW_LOCK(state); if (!busy) { state->idle = 0; @@ -229,13 +230,11 @@ handleevents(sbintime_t now, int fake) * Schedule binuptime of the next event on current CPU. */ static sbintime_t -getnextcpuevent(int idle) +getnextcpuevent(struct pcpu_state *state, int idle) { sbintime_t event; - struct pcpu_state *state; u_int hardfreq; - state = DPCPU_PTR(timerstate); /* Handle hardclock() events, skipping some if CPU is idle. */ event = state->nexthard; if (idle) { @@ -266,9 +265,8 @@ getnextcpuevent(int idle) * Schedule binuptime of the next event on all CPUs. */ static sbintime_t -getnextevent(void) +getnextevent(struct pcpu_state *state) { - struct pcpu_state *state; sbintime_t event; #ifdef SMP int cpu; @@ -278,7 +276,6 @@ getnextevent(void) c = -1; #endif - state = DPCPU_PTR(timerstate); event = state->nextevent; #ifdef SMP if ((timer->et_flags & ET_FLAGS_PERCPU) == 0) { @@ -385,10 +382,10 @@ loadtimer(sbintime_t now, int start) uint64_t tmp; int eq; - if (timer->et_flags & ET_FLAGS_PERCPU) { - state = DPCPU_PTR(timerstate); + state = DPCPU_PTR(timerstate); + if (timer->et_flags & ET_FLAGS_PERCPU) next = &state->nexttick; - } else + else next = &nexttick; if (periodic) { if (start) { @@ -407,7 +404,7 @@ loadtimer(sbintime_t now, int start) et_start(timer, new, timerperiod); } } else { - new = getnextevent(); + new = getnextevent(state); eq = (new == *next); CTR4(KTR_SPARE2, "load at %d: next %d.%08x eq %d", curcpu, (int)(new >> 32), (u_int)(new & 0xffffffff), eq); @@ -778,7 +775,7 @@ cpu_idleclock(void) now = sbinuptime(); CTR3(KTR_SPARE2, "idle at %d: now %d.%08x", curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); - t = getnextcpuevent(1); + t = getnextcpuevent(state, 1); ET_HW_LOCK(state); state->idle = 1; state->nextevent = t;