Date: Thu, 6 Sep 2018 02:10:59 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338487 - in head/sys: kern sys Message-ID: <201809060210.w862AxxL031410@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Thu Sep 6 02:10:59 2018 New Revision: 338487 URL: https://svnweb.freebsd.org/changeset/base/338487 Log: Rename hardclock_cnt() to hardclock() and remove the old implementation. Also remove some related and unused subroutines. They have long been replaced by variants that handle multiple coalesced events with a single call. No functional change intended. Reviewed by: cem, kib Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17029 Modified: head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/sys/systm.h Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/kern/kern_clock.c Thu Sep 6 02:10:59 2018 (r338487) @@ -421,85 +421,12 @@ initclocks(void *dummy) #endif } -/* - * Each time the real-time timer fires, this function is called on all CPUs. - * Note that hardclock() calls hardclock_cpu() for the boot CPU, so only - * the other CPUs in the system need to call this function. - */ void -hardclock_cpu(int usermode) +hardclock(int cnt, int usermode) { struct pstats *pstats; struct thread *td = curthread; struct proc *p = td->td_proc; - int flags; - - /* - * Run current process's virtual and profile time, as needed. - */ - pstats = p->p_stats; - flags = 0; - if (usermode && - timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) { - PROC_ITIMLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) - flags |= TDF_ALRMPEND | TDF_ASTPENDING; - PROC_ITIMUNLOCK(p); - } - if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) { - PROC_ITIMLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) - flags |= TDF_PROFPEND | TDF_ASTPENDING; - PROC_ITIMUNLOCK(p); - } - thread_lock(td); - td->td_flags |= flags; - thread_unlock(td); - -#ifdef HWPMC_HOOKS - if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) - PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); - if (td->td_intr_frame != NULL) - PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); -#endif - callout_process(sbinuptime()); - if (__predict_false(DPCPU_GET(epoch_cb_count))) - GROUPTASK_ENQUEUE(DPCPU_PTR(epoch_cb_task)); -} - -/* - * The real-time timer, interrupting hz times per second. - */ -void -hardclock(int usermode, uintfptr_t pc) -{ - - atomic_add_int(&ticks, 1); - hardclock_cpu(usermode); - tc_ticktock(1); - cpu_tick_calibration(); - /* - * If no separate statistics clock is available, run it from here. - * - * XXX: this only works for UP - */ - if (stathz == 0) { - profclock(usermode, pc); - statclock(usermode); - } -#ifdef DEVICE_POLLING - hardclock_device_poll(); /* this is very short and quick */ -#endif /* DEVICE_POLLING */ - if (watchdog_enabled > 0 && --watchdog_ticks <= 0) - watchdog_fire(); -} - -void -hardclock_cnt(int cnt, int usermode) -{ - struct pstats *pstats; - struct thread *td = curthread; - struct proc *p = td->td_proc; int *t = DPCPU_PTR(pcputicks); int flags, global, newticks; int i; @@ -696,15 +623,8 @@ stopprofclock(struct proc *p) * This should be called by all active processors. */ void -statclock(int usermode) +statclock(int cnt, int usermode) { - - statclock_cnt(1, usermode); -} - -void -statclock_cnt(int cnt, int usermode) -{ struct rusage *ru; struct vmspace *vm; struct thread *td; @@ -776,14 +696,7 @@ statclock_cnt(int cnt, int usermode) } void -profclock(int usermode, uintfptr_t pc) -{ - - profclock_cnt(1, usermode, pc); -} - -void -profclock_cnt(int cnt, int usermode, uintfptr_t pc) +profclock(int cnt, int usermode, uintfptr_t pc) { struct thread *td; #ifdef GPROF Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/kern/kern_clocksource.c Thu Sep 6 02:10:59 2018 (r338487) @@ -183,7 +183,7 @@ handleevents(sbintime_t now, int fake) hct = DPCPU_PTR(hardclocktime); *hct = state->nexthard - tick_sbt; if (fake < 2) { - hardclock_cnt(runs, usermode); + hardclock(runs, usermode); done = 1; } } @@ -193,7 +193,7 @@ handleevents(sbintime_t now, int fake) runs++; } if (runs && fake < 2) { - statclock_cnt(runs, usermode); + statclock(runs, usermode); done = 1; } if (profiling) { @@ -203,7 +203,7 @@ handleevents(sbintime_t now, int fake) runs++; } if (runs && !fake) { - profclock_cnt(runs, usermode, TRAPF_PC(frame)); + profclock(runs, usermode, TRAPF_PC(frame)); done = 1; } } else Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/sys/systm.h Thu Sep 6 02:10:59 2018 (r338487) @@ -363,15 +363,11 @@ void realitexpire(void *); int sysbeep(int hertz, int period); -void hardclock(int usermode, uintfptr_t pc); -void hardclock_cnt(int cnt, int usermode); -void hardclock_cpu(int usermode); +void hardclock(int cnt, int usermode); void hardclock_sync(int cpu); void softclock(void *); -void statclock(int usermode); -void statclock_cnt(int cnt, int usermode); -void profclock(int usermode, uintfptr_t pc); -void profclock_cnt(int cnt, int usermode, uintfptr_t pc); +void statclock(int cnt, int usermode); +void profclock(int cnt, int usermode, uintfptr_t pc); int hardclockintr(void);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809060210.w862AxxL031410>