From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 2 20:34:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4282E1065673; Mon, 2 Apr 2012 20:34:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2369C8FC0A; Mon, 2 Apr 2012 20:34:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q32KYf0b015799; Mon, 2 Apr 2012 20:34:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q32KYff2015791; Mon, 2 Apr 2012 20:34:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201204022034.q32KYff2015791@svn.freebsd.org> From: John Baldwin Date: Mon, 2 Apr 2012 20:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233815 - in stable/8/sys: i386/conf kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2012 20:34:42 -0000 Author: jhb Date: Mon Apr 2 20:34:41 2012 New Revision: 233815 URL: http://svn.freebsd.org/changeset/base/233815 Log: MFC 232700: Add a new sched_clear_name() method to the scheduler interface to clear the cached name used for KTR_SCHED traces when a thread's name changes. This way KTR_SCHED traces (and thus schedgraph) will notice when a thread's name changes, most commonly via execve(). Modified: stable/8/sys/kern/kern_exec.c stable/8/sys/kern/kern_intr.c stable/8/sys/kern/kern_kthread.c stable/8/sys/kern/kern_thr.c stable/8/sys/kern/sched_4bsd.c stable/8/sys/kern/sched_ule.c stable/8/sys/sys/sched.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/kern_exec.c ============================================================================== --- stable/8/sys/kern/kern_exec.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/kern_exec.c Mon Apr 2 20:34:41 2012 (r233815) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -609,6 +610,9 @@ interpret: else if (vn_commname(binvp, p->p_comm, sizeof(p->p_comm)) != 0) bcopy(fexecv_proc_title, p->p_comm, sizeof(fexecv_proc_title)); bcopy(p->p_comm, td->td_name, sizeof(td->td_name)); +#ifdef KTR + sched_clear_tdname(td); +#endif /* * mark as execed, wakeup the process that vforked (if any) and tell Modified: stable/8/sys/kern/kern_intr.c ============================================================================== --- stable/8/sys/kern/kern_intr.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/kern_intr.c Mon Apr 2 20:34:41 2012 (r233815) @@ -179,6 +179,9 @@ ithread_update(struct intr_thread *ithd) /* Update name and priority. */ strlcpy(td->td_name, ie->ie_fullname, sizeof(td->td_name)); +#ifdef KTR + sched_clear_tdname(td); +#endif thread_lock(td); sched_prio(td, pri); thread_unlock(td); Modified: stable/8/sys/kern/kern_kthread.c ============================================================================== --- stable/8/sys/kern/kern_kthread.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/kern_kthread.c Mon Apr 2 20:34:41 2012 (r233815) @@ -114,6 +114,9 @@ kproc_create(void (*func)(void *), void va_start(ap, fmt); vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); va_end(ap); +#ifdef KTR + sched_clear_tdname(td); +#endif /* call the processes' main()... */ cpu_set_fork_handler(td, func, arg); @@ -414,6 +417,9 @@ kproc_kthread_add(void (*func)(void *), va_start(ap, fmt); vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); va_end(ap); +#ifdef KTR + sched_clear_tdname(td); +#endif return (0); } va_start(ap, fmt); Modified: stable/8/sys/kern/kern_thr.c ============================================================================== --- stable/8/sys/kern/kern_thr.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/kern_thr.c Mon Apr 2 20:34:41 2012 (r233815) @@ -528,6 +528,9 @@ thr_set_name(struct thread *td, struct t strcpy(ttd->td_name, name); else error = ESRCH; +#ifdef KTR + sched_clear_tdname(ttd); +#endif PROC_UNLOCK(p); return (error); } Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/sched_4bsd.c Mon Apr 2 20:34:41 2012 (r233815) @@ -1613,6 +1613,17 @@ sched_tdname(struct thread *td) #endif } +#ifdef KTR +void +sched_clear_tdname(struct thread *td) +{ + struct td_sched *ts; + + ts = td->td_sched; + ts->ts_name[0] = '\0'; +} +#endif + void sched_affinity(struct thread *td) { Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/kern/sched_ule.c Mon Apr 2 20:34:41 2012 (r233815) @@ -2645,6 +2645,17 @@ sched_tdname(struct thread *td) #endif } +#ifdef KTR +void +sched_clear_tdname(struct thread *td) +{ + struct td_sched *ts; + + ts = td->td_sched; + ts->ts_name[0] = '\0'; +} +#endif + #ifdef SMP /* Modified: stable/8/sys/sys/sched.h ============================================================================== --- stable/8/sys/sys/sched.h Mon Apr 2 20:34:15 2012 (r233814) +++ stable/8/sys/sys/sched.h Mon Apr 2 20:34:41 2012 (r233815) @@ -139,6 +139,9 @@ int sched_sizeof_thread(void); * functions. */ char *sched_tdname(struct thread *td); +#ifdef KTR +void sched_clear_tdname(struct thread *td); +#endif static __inline void sched_pin(void)