Use TAILQ instead of STAILQ for kqeueue filedescriptors to ensure constant

time removal on kqueue close.

Reported and tested by:	pho
Reviewed by:	jmg
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Approved by:	re (delphij)
This commit is contained in:
Konstantin Belousov 2013-09-13 19:50:50 +00:00
parent 40e463f4d9
commit e8de242d3a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255527
3 changed files with 5 additions and 5 deletions

View File

@ -707,7 +707,7 @@ sys_kqueue(struct thread *td, struct kqueue_args *uap)
TASK_INIT(&kq->kq_task, 0, kqueue_task, kq);
FILEDESC_XLOCK(fdp);
SLIST_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_list);
TAILQ_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_list);
FILEDESC_XUNLOCK(fdp);
finit(fp, FREAD | FWRITE, DTYPE_KQUEUE, kq, &kqueueops);
@ -1718,7 +1718,7 @@ kqueue_close(struct file *fp, struct thread *td)
KQ_UNLOCK(kq);
FILEDESC_XLOCK(fdp);
SLIST_REMOVE(&fdp->fd_kqlist, kq, kqueue, kq_list);
TAILQ_REMOVE(&fdp->fd_kqlist, kq, kq_list);
FILEDESC_XUNLOCK(fdp);
seldrain(&kq->kq_sel);
@ -2095,7 +2095,7 @@ knote_fdclose(struct thread *td, int fd)
* We shouldn't have to worry about new kevents appearing on fd
* since filedesc is locked.
*/
SLIST_FOREACH(kq, &fdp->fd_kqlist, kq_list) {
TAILQ_FOREACH(kq, &fdp->fd_kqlist, kq_list) {
KQ_LOCK(kq);
again:

View File

@ -135,7 +135,7 @@ struct kevent {
struct knote;
SLIST_HEAD(klist, knote);
struct kqueue;
SLIST_HEAD(kqlist, kqueue);
TAILQ_HEAD(kqlist, kqueue);
struct knlist {
struct klist kl_list;
void (*kl_lock)(void *); /* lock function */

View File

@ -41,7 +41,7 @@
struct kqueue {
struct mtx kq_lock;
int kq_refcnt;
SLIST_ENTRY(kqueue) kq_list;
TAILQ_ENTRY(kqueue) kq_list;
TAILQ_HEAD(, knote) kq_head; /* list of pending event */
int kq_count; /* number of pending events */
struct selinfo kq_sel;