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
This commit is contained in:
Konstantin Belousov 2021-12-27 20:29:22 +02:00
parent 3f15708478
commit 23ba59fbfb
2 changed files with 1 additions and 34 deletions

View File

@ -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;

View File

@ -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];
};