From owner-svn-src-all@freebsd.org Fri Nov 30 03:02:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75A5011557EA; Fri, 30 Nov 2018 03:02:23 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFAC58F52D; Fri, 30 Nov 2018 03:01:33 +0000 (UTC) (envelope-from vangyzen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B218822A1A; Fri, 30 Nov 2018 03:01:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wAU31XM3056550; Fri, 30 Nov 2018 03:01:33 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAU31X5o056547; Fri, 30 Nov 2018 03:01:33 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201811300301.wAU31X5o056547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 30 Nov 2018 03:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341277 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 341277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CFAC58F52D X-Spamd-Result: default: False [1.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.55)[0.546,0]; NEURAL_SPAM_MEDIUM(0.26)[0.256,0]; NEURAL_SPAM_LONG(0.31)[0.307,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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, 30 Nov 2018 03:02:23 -0000 Author: vangyzen Date: Fri Nov 30 03:01:32 2018 New Revision: 341277 URL: https://svnweb.freebsd.org/changeset/base/341277 Log: _thr_setthreaded() cannot fail; change return type to void Also remove logic to avoid unnecessary stores to the global variable. Thread creation and destruction are heavy enough that any supposed savings is in the noise. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libthr/thread/thr_create.c head/lib/libthr/thread/thr_kern.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_create.c ============================================================================== --- head/lib/libthr/thread/thr_create.c Fri Nov 30 02:14:41 2018 (r341276) +++ head/lib/libthr/thread/thr_create.c Fri Nov 30 03:01:32 2018 (r341277) @@ -73,8 +73,7 @@ _pthread_create(pthread_t * __restrict thread, */ if (_thr_isthreaded() == 0) { _malloc_first_thread(); - if (_thr_setthreaded(1)) - return (EAGAIN); + _thr_setthreaded(1); } curthread = _get_curthread(); Modified: head/lib/libthr/thread/thr_kern.c ============================================================================== --- head/lib/libthr/thread/thr_kern.c Fri Nov 30 02:14:41 2018 (r341276) +++ head/lib/libthr/thread/thr_kern.c Fri Nov 30 03:01:32 2018 (r341277) @@ -53,14 +53,10 @@ static struct wake_addr default_wake_addr; * This is called when the first thread (other than the initial * thread) is created. */ -int +void _thr_setthreaded(int threaded) { - if (((threaded == 0) ^ (__isthreaded == 0)) == 0) - return (0); - __isthreaded = threaded; - return (0); } void Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Fri Nov 30 02:14:41 2018 (r341276) +++ head/lib/libthr/thread/thr_private.h Fri Nov 30 03:01:32 2018 (r341277) @@ -776,7 +776,7 @@ extern struct pthread *_single_thread __hidden; * Function prototype definitions. */ __BEGIN_DECLS -int _thr_setthreaded(int) __hidden; +void _thr_setthreaded(int) __hidden; int _mutex_cv_lock(struct pthread_mutex *, int, bool) __hidden; int _mutex_cv_unlock(struct pthread_mutex *, int *, int *) __hidden; int _mutex_cv_attach(struct pthread_mutex *, int) __hidden;