Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107088459
D30251.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D30251.diff
View Options
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -680,11 +680,14 @@
struct proc *p;
struct knote *kn;
int cpuid;
+ int flags;
TAILQ_ENTRY(kq_timer_cb_data) link;
sbintime_t next; /* next timer event fires at */
sbintime_t to; /* precalculated timer period, 0 for abs */
};
+#define KQ_TIMER_CB_ENQUEUED 0x01
+
static void
kqtimer_sched_callout(struct kq_timer_cb_data *kc)
{
@@ -706,6 +709,7 @@
TAILQ_FOREACH_SAFE(kc, &p->p_kqtim_stop, link, kc1) {
TAILQ_REMOVE(&p->p_kqtim_stop, kc, link);
+ kc->flags &= ~KQ_TIMER_CB_ENQUEUED;
if (kc->next <= now)
filt_timerexpire_l(kc->kn, true);
else
@@ -753,7 +757,10 @@
if (!proc_locked)
PROC_LOCK(p);
if (P_SHOULDSTOP(p) || P_KILLED(p)) {
- TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link);
+ if ((kc->flags & KQ_TIMER_CB_ENQUEUED) == 0) {
+ kc->flags |= KQ_TIMER_CB_ENQUEUED;
+ TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link);
+ }
if (!proc_locked)
PROC_UNLOCK(p);
return;
@@ -826,6 +833,7 @@
kc->kn = kn;
kc->p = curproc;
kc->cpuid = PCPU_GET(cpuid);
+ kc->flags = 0;
callout_init(&kc->c, 1);
filt_timerstart(kn, to);
@@ -856,6 +864,11 @@
kc = kn->kn_ptr.p_v;
callout_drain(&kc->c);
+ if ((kc->flags & KQ_TIMER_CB_ENQUEUED) != 0) {
+ PROC_LOCK(kc->p);
+ TAILQ_REMOVE(&kc->p->p_kqtim_stop, kc, link);
+ PROC_UNLOCK(kc->p);
+ }
free(kc, M_KQUEUE);
old = atomic_fetchadd_int(&kq_ncallouts, -1);
KASSERT(old > 0, ("Number of callouts cannot become negative"));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 10:30 PM (16 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15747384
Default Alt Text
D30251.diff (1 KB)
Attached To
Mode
D30251: kqueue timer: Remove detached knotes from the process stop queue
Attached
Detach File
Event Timeline
Log In to Comment