Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322613
b: refs/heads/master
c: 552a37e
h: refs/heads/master
i:
  322611: 58fd476
v: v3
  • Loading branch information
Lai Jiangshan authored and Tejun Heo committed Sep 10, 2012
1 parent 76d1920 commit e8d3cfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec58815ab0409a921a7c9744eb4ca44866b14d71
refs/heads/master: 552a37e9360a293cd20e7f8ff1fb326a244c5f1e
5 changes: 4 additions & 1 deletion trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum {

/* pool flags */
POOL_MANAGE_WORKERS = 1 << 0, /* need to manage workers */
POOL_MANAGING_WORKERS = 1 << 1, /* managing workers */

/* worker flags */
WORKER_STARTED = 1 << 0, /* started */
Expand Down Expand Up @@ -652,7 +653,7 @@ static bool need_to_manage_workers(struct worker_pool *pool)
/* Do we have too many workers and should some go away? */
static bool too_many_workers(struct worker_pool *pool)
{
bool managing = mutex_is_locked(&pool->manager_mutex);
bool managing = pool->flags & POOL_MANAGING_WORKERS;
int nr_idle = pool->nr_idle + managing; /* manager is considered idle */
int nr_busy = pool->nr_workers - nr_idle;

Expand Down Expand Up @@ -1827,6 +1828,7 @@ static bool manage_workers(struct worker *worker)
if (!mutex_trylock(&pool->manager_mutex))
return ret;

pool->flags |= POOL_MANAGING_WORKERS;
pool->flags &= ~POOL_MANAGE_WORKERS;

/*
Expand All @@ -1836,6 +1838,7 @@ static bool manage_workers(struct worker *worker)
ret |= maybe_destroy_workers(pool);
ret |= maybe_create_worker(pool);

pool->flags &= ~POOL_MANAGING_WORKERS;
mutex_unlock(&pool->manager_mutex);
return ret;
}
Expand Down

0 comments on commit e8d3cfa

Please sign in to comment.