From owner-svn-src-head@freebsd.org Wed Apr 19 11:38:08 2017 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 C05FFD45EFF; Wed, 19 Apr 2017 11:38:08 +0000 (UTC) (envelope-from hselasky@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 8CDBD19D4; Wed, 19 Apr 2017 11:38:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3JBc7NN056616; Wed, 19 Apr 2017 11:38:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3JBc7Up056615; Wed, 19 Apr 2017 11:38:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201704191138.v3JBc7Up056615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Apr 2017 11:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317135 - head/sys/compat/linuxkpi/common/src 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.23 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: Wed, 19 Apr 2017 11:38:08 -0000 Author: hselasky Date: Wed Apr 19 11:38:07 2017 New Revision: 317135 URL: https://svnweb.freebsd.org/changeset/base/317135 Log: Zero number of CPUs should be translated into the default number of CPUs when allocating a LinuxKPI workqueue. This also ensures that the created taskqueue always have a non-zero number of worker threads. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_work.c Modified: head/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_work.c Wed Apr 19 11:13:32 2017 (r317134) +++ head/sys/compat/linuxkpi/common/src/linux_work.c Wed Apr 19 11:38:07 2017 (r317135) @@ -57,6 +57,8 @@ struct workqueue_struct *system_long_wq; struct workqueue_struct *system_unbound_wq; struct workqueue_struct *system_power_efficient_wq; +static int linux_default_wq_cpus = 4; + static void linux_delayed_work_timer_fn(void *); /* @@ -497,6 +499,12 @@ linux_create_workqueue_common(const char { struct workqueue_struct *wq; + /* + * If zero CPUs are specified use the default number of CPUs: + */ + if (cpus == 0) + cpus = linux_default_wq_cpus; + wq = kmalloc(sizeof(*wq), M_WAITOK | M_ZERO); wq->taskqueue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, &wq->taskqueue); @@ -537,6 +545,9 @@ linux_work_init(void *arg) if (max_wq_cpus < 4) max_wq_cpus = 4; + /* set default number of CPUs */ + linux_default_wq_cpus = max_wq_cpus; + linux_system_short_wq = alloc_workqueue("linuxkpi_short_wq", 0, max_wq_cpus); linux_system_long_wq = alloc_workqueue("linuxkpi_long_wq", 0, max_wq_cpus);