From owner-svn-src-head@FreeBSD.ORG Sun Dec 9 04:54:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D59261B; Sun, 9 Dec 2012 04:54:23 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF968FC12; Sun, 9 Dec 2012 04:54:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB94sNe8087136; Sun, 9 Dec 2012 04:54:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB94sNNZ087134; Sun, 9 Dec 2012 04:54:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201212090454.qB94sNNZ087134@svn.freebsd.org> From: Attilio Rao Date: Sun, 9 Dec 2012 04:54:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244046 - 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.14 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: Sun, 09 Dec 2012 04:54:23 -0000 Author: attilio Date: Sun Dec 9 04:54:22 2012 New Revision: 244046 URL: http://svnweb.freebsd.org/changeset/base/244046 Log: Add a comment on why inlining critical_enter() may not be a good idea for the general case. Reviewed by: bde MFC after: 1 week Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c ============================================================================== --- head/sys/kern/kern_switch.c Sun Dec 9 04:15:51 2012 (r244045) +++ head/sys/kern/kern_switch.c Sun Dec 9 04:54:22 2012 (r244046) @@ -176,6 +176,12 @@ retry: /* * Kernel thread preemption implementation. Critical sections mark * regions of code in which preemptions are not allowed. + * + * It might seem a good idea to inline critical_enter() but, in order + * to prevent instructions reordering by the compiler, a __compiler_membar() + * would have to be used here (the same as sched_pin()). The performance + * penalty imposed by the membar could, then, produce slower code than + * the function call itself, for most cases. */ void critical_enter(void)