summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aio_pthread.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-01-06 14:33:56 -0800
committerJeremy Allison <jra@samba.org>2012-01-06 14:55:03 -0800
commit12bef8460791903b5f3a195973d0d5e8de895608 (patch)
tree701ff5634ff85ad416a0f34dc7ecae9d9921b062 /source3/modules/vfs_aio_pthread.c
parent5cddd22cd8d933cbd4e83edfd518556acaf732f9 (diff)
downloadsamba-12bef8460791903b5f3a195973d0d5e8de895608.tar.gz
Add "aio num threads" parameter to allow manual configuration of
threads via smb.conf if required. Ignore the number of cores. See comments inline.
Diffstat (limited to 'source3/modules/vfs_aio_pthread.c')
-rw-r--r--source3/modules/vfs_aio_pthread.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index 9217b69e80f..61520a33156 100644
--- a/source3/modules/vfs_aio_pthread.c
+++ b/source3/modules/vfs_aio_pthread.c
@@ -51,21 +51,20 @@ static void aio_pthread_handle_completion(struct event_context *event_ctx,
/************************************************************************
How many threads to initialize ?
+ 100 per process seems insane as a default until you realize that
+ (a) Threads terminate after 1 second when idle.
+ (b) Throttling is done in SMB2 via the crediting algorithm.
+ (c) SMB1 clients are limited to max_mux (50) outstanding requests and
+ Windows clients don't use this anyway.
+ Essentially we want this to be unlimited unless smb.conf says different.
***********************************************************************/
-static int aio_get_num_threads(void)
+static int aio_get_num_threads(struct vfs_handle_struct *handle)
{
- int num_cores = sys_get_number_of_cores();
- DEBUG(10,("aio_get_num_threads: sys_get_number_of_cores "
- "returned %d\n",
- num_cores));
- num_cores *= 2;
- if (num_cores < 1) {
- num_cores = 1;
- }
- /* Even on a single processor box give a little
- concurrency. */
- return MIN(4,num_cores);
+ return lp_parm_bool(SNUM(handle->conn),
+ "aio_pthread",
+ "aio num threads",
+ 100);
}
#if 0
@@ -108,7 +107,7 @@ static void idle_pool_destroy_timer(struct tevent_context *ev,
Ensure thread pool is initialized.
***********************************************************************/
-static bool init_aio_threadpool(void)
+static bool init_aio_threadpool(struct vfs_handle_struct *handle)
{
struct fd_event *sock_event = NULL;
int ret = 0;
@@ -121,7 +120,7 @@ static bool init_aio_threadpool(void)
return true;
}
- num_threads = aio_get_num_threads();
+ num_threads = aio_get_num_threads(handle);
ret = pthreadpool_init(num_threads, &pool);
if (ret) {
errno = ret;
@@ -228,7 +227,7 @@ static int aio_pthread_read(struct vfs_handle_struct *handle,
struct aio_private_data *pd = NULL;
int ret;
- if (!init_aio_threadpool()) {
+ if (!init_aio_threadpool(handle)) {
return -1;
}
@@ -265,7 +264,7 @@ static int aio_pthread_write(struct vfs_handle_struct *handle,
struct aio_private_data *pd = NULL;
int ret;
- if (!init_aio_threadpool()) {
+ if (!init_aio_threadpool(handle)) {
return -1;
}