From 23ba59fbfb6ad580c4f185ffea2fa8a32b4d131d Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 27 Dec 2021 20:29:22 +0200 Subject: [PATCH] itimers: strip unused bits from struct itimer and struct itimers Reviewed by: imp, markj, mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33670 --- sys/kern/kern_time.c | 6 ------ sys/sys/timers.h | 29 +---------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 4c53b728a500..74e7c42004ad 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1266,13 +1266,11 @@ kern_ktimer_create(struct thread *td, clockid_t clock_id, struct sigevent *evp, it = uma_zalloc(itimer_zone, M_WAITOK); it->it_flags = 0; it->it_usecount = 0; - it->it_active = 0; timespecclear(&it->it_time.it_value); timespecclear(&it->it_time.it_interval); it->it_overrun = 0; it->it_overrun_last = 0; it->it_clockid = clock_id; - it->it_timerid = -1; it->it_proc = p; ksiginfo_init(&it->it_ksi); it->it_ksi.ksi_flags |= KSI_INS | KSI_EXT; @@ -1303,7 +1301,6 @@ kern_ktimer_create(struct thread *td, clockid_t clock_id, struct sigevent *evp, goto out; } } - it->it_timerid = id; p->p_itimers->its_timers[id] = it; if (evp != NULL) it->it_sigev = *evp; @@ -1787,9 +1784,6 @@ itimers_alloc(struct proc *p) struct itimers *its; its = malloc(sizeof (struct itimers), M_SUBPROC, M_WAITOK | M_ZERO); - LIST_INIT(&its->its_virtual); - LIST_INIT(&its->its_prof); - TAILQ_INIT(&its->its_worklist); PROC_LOCK(p); if (p->p_itimers == NULL) { p->p_itimers = its; diff --git a/sys/sys/timers.h b/sys/sys/timers.h index 5d6f0c95afa2..9e4597bca21b 100644 --- a/sys/sys/timers.h +++ b/sys/sys/timers.h @@ -56,47 +56,20 @@ struct itimer { int it_overrun; /* Overruns currently accumulating */ int it_overrun_last; /* Overruns associated w/ a delivery */ int it_clockid; - int it_timerid; ksiginfo_t it_ksi; - union { - /* realtime */ - struct { - struct callout it_callout; - } _rt; - - /* cpu timer */ - struct { - LIST_ENTRY(itimer) it_link; - TAILQ_ENTRY(itimer) it_worklink; - int it_active; - int it_cflags; - } _cpu; - } _data; + struct callout it_callout; }; -#define it_callout _data._rt.it_callout -#define it_link _data._cpu.it_link -#define it_active _data._cpu.it_active -#define it_worklink _data._cpu.it_worklink -#define it_cflags _data._cpu.it_cflags - #define ITF_DELETING 0x01 #define ITF_WANTED 0x02 #define ITF_PSTOPPED 0x04 -#define ITCF_ONWORKLIST 0x01 - #define TIMER_MAX 32 #define ITIMER_LOCK(it) mtx_lock(&(it)->it_mtx) #define ITIMER_UNLOCK(it) mtx_unlock(&(it)->it_mtx) -LIST_HEAD(itimerlist, itimer); - struct itimers { - struct itimerlist its_virtual; - struct itimerlist its_prof; - TAILQ_HEAD(, itimer) its_worklist; struct itimer *its_timers[TIMER_MAX]; };