Date: Wed, 19 Apr 2017 11:38:07 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> 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 Message-ID: <201704191138.v3JBc7Up056615@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704191138.v3JBc7Up056615>