From owner-svn-src-head@freebsd.org Tue Oct 20 20:29:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5567A0A4DD; Tue, 20 Oct 2015 20:29:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 921929DA; Tue, 20 Oct 2015 20:29:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9KKTLxZ060976; Tue, 20 Oct 2015 20:29:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9KKTLK7060975; Tue, 20 Oct 2015 20:29:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510202029.t9KKTLK7060975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Oct 2015 20:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289661 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2015 20:29:22 -0000 Author: kib Date: Tue Oct 20 20:29:21 2015 New Revision: 289661 URL: https://svnweb.freebsd.org/changeset/base/289661 Log: Mark struct thread zone as type-stable. When establishing the locking state for several lock types (including blockable mutexes and sx) failed, locking primitives try to spin while the owner thread is running. The spinning loop performs the test for running condition by dereferencing the owner->td_state field of the owner thread. If the owner thread exited while spinner was put off the processor, it is harmless to access reused struct thread owner, since in some near future the current processor would notice the owner change and make appropriate progress. But it could be that the page which carried the freed struct thread was unmapped, then we fault (this cannot happen on amd64). For now, disallowing free of the struct thread seems to be good enough, and tests which create a lot of threads once, did not demonstrated regressions. Reviewed by: jhb, pho Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D3908 Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Oct 20 20:22:57 2015 (r289660) +++ head/sys/kern/kern_thread.c Tue Oct 20 20:29:21 2015 (r289661) @@ -281,7 +281,7 @@ threadinit(void) thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(), thread_ctor, thread_dtor, thread_init, thread_fini, - 16 - 1, 0); + 16 - 1, UMA_ZONE_NOFREE); tidhashtbl = hashinit(maxproc / 2, M_TIDHASH, &tidhash); rw_init(&tidhash_lock, "tidhash"); }