From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:25:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99E4F1065672; Wed, 26 Sep 2012 09:25:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85E8E8FC23; Wed, 26 Sep 2012 09:25:12 +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 q8Q9PCmP099045; Wed, 26 Sep 2012 09:25:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9PCSs099043; Wed, 26 Sep 2012 09:25:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209260925.q8Q9PCSs099043@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Sep 2012 09:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240951 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 26 Sep 2012 09:25:12 -0000 Author: kib Date: Wed Sep 26 09:25:11 2012 New Revision: 240951 URL: http://svn.freebsd.org/changeset/base/240951 Log: Make the updates of the tid ring buffer' head and tail pointers explicit by moving them into separate statements from the buffer element accesses. Requested by: jhb MFC after: 3 days Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Sep 26 09:22:28 2012 (r240950) +++ head/sys/kern/kern_thread.c Wed Sep 26 09:25:11 2012 (r240951) @@ -102,8 +102,8 @@ tid_alloc(void) mtx_unlock(&tid_lock); return (-1); } - tid = tid_buffer[tid_head++]; - tid_head %= TID_BUFFER_SIZE; + tid = tid_buffer[tid_head]; + tid_head = (tid_head + 1) % TID_BUFFER_SIZE; mtx_unlock(&tid_lock); return (tid); } @@ -115,11 +115,11 @@ tid_free(lwpid_t tid) mtx_lock(&tid_lock); if ((tid_tail + 1) % TID_BUFFER_SIZE == tid_head) { - tmp_tid = tid_buffer[tid_head++]; - tid_head %= TID_BUFFER_SIZE; + tmp_tid = tid_buffer[tid_head]; + tid_head = (tid_head + 1) % TID_BUFFER_SIZE; } - tid_buffer[tid_tail++] = tid; - tid_tail %= TID_BUFFER_SIZE; + tid_buffer[tid_tail] = tid; + tid_tail = (tid_tail + 1) % TID_BUFFER_SIZE; mtx_unlock(&tid_lock); if (tmp_tid != -1) free_unr(tid_unrhdr, tmp_tid);