From owner-svn-src-all@FreeBSD.ORG Fri Sep 13 19:50:51 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8DC08B2B; Fri, 13 Sep 2013 19:50:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 61FE12DC6; Fri, 13 Sep 2013 19:50:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DJopWQ024753; Fri, 13 Sep 2013 19:50:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DJooh2024750; Fri, 13 Sep 2013 19:50:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309131950.r8DJooh2024750@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Sep 2013 19:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255527 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 19:50:51 -0000 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;