Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2013 19:50:50 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255527 - in head/sys: kern sys
Message-ID:  <201309131950.r8DJooh2024750@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Sep 13 19:50:50 2013
New Revision: 255527
URL: http://svnweb.freebsd.org/changeset/base/255527

Log:
  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)

Modified:
  head/sys/kern/kern_event.c
  head/sys/sys/event.h
  head/sys/sys/eventvar.h

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Fri Sep 13 19:19:21 2013	(r255526)
+++ head/sys/kern/kern_event.c	Fri Sep 13 19:50:50 2013	(r255527)
@@ -707,7 +707,7 @@ sys_kqueue(struct thread *td, struct kqu
 	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 thr
 	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:

Modified: head/sys/sys/event.h
==============================================================================
--- head/sys/sys/event.h	Fri Sep 13 19:19:21 2013	(r255526)
+++ head/sys/sys/event.h	Fri Sep 13 19:50:50 2013	(r255527)
@@ -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 */

Modified: head/sys/sys/eventvar.h
==============================================================================
--- head/sys/sys/eventvar.h	Fri Sep 13 19:19:21 2013	(r255526)
+++ head/sys/sys/eventvar.h	Fri Sep 13 19:50:50 2013	(r255527)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309131950.r8DJooh2024750>