Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206232
b: refs/heads/master
c: fb0e7be
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Jun 29, 2010
1 parent 01bcab8 commit 41814b5
Show file tree
Hide file tree
Showing 3 changed files with 17 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: 649027d73a6309ac34dc2886362e662bd73456dc
refs/heads/master: fb0e7beb5c1b6fb4da786ba709d7138373d5fb22
1 change: 1 addition & 0 deletions trunk/include/linux/workqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ enum {
WQ_NON_REENTRANT = 1 << 2, /* guarantee non-reentrance */
WQ_RESCUER = 1 << 3, /* has an rescue worker */
WQ_HIGHPRI = 1 << 4, /* high priority */
WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */

WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
Expand Down
16 changes: 15 additions & 1 deletion trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ enum {
WORKER_PREP = 1 << 3, /* preparing to run works */
WORKER_ROGUE = 1 << 4, /* not bound to any cpu */
WORKER_REBIND = 1 << 5, /* mom is home, come back */
WORKER_CPU_INTENSIVE = 1 << 6, /* cpu intensive */

WORKER_NOT_RUNNING = WORKER_PREP | WORKER_ROGUE | WORKER_REBIND,
WORKER_NOT_RUNNING = WORKER_PREP | WORKER_ROGUE | WORKER_REBIND |
WORKER_CPU_INTENSIVE,

/* gcwq->trustee_state */
TRUSTEE_START = 0, /* start */
Expand Down Expand Up @@ -1641,6 +1643,7 @@ static void process_one_work(struct worker *worker, struct work_struct *work)
struct cpu_workqueue_struct *cwq = get_work_cwq(work);
struct global_cwq *gcwq = cwq->gcwq;
struct hlist_head *bwh = busy_worker_head(gcwq, work);
bool cpu_intensive = cwq->wq->flags & WQ_CPU_INTENSIVE;
work_func_t f = work->func;
int work_color;
struct worker *collision;
Expand Down Expand Up @@ -1692,6 +1695,13 @@ static void process_one_work(struct worker *worker, struct work_struct *work)
gcwq->flags &= ~GCWQ_HIGHPRI_PENDING;
}

/*
* CPU intensive works don't participate in concurrency
* management. They're the scheduler's responsibility.
*/
if (unlikely(cpu_intensive))
worker_set_flags(worker, WORKER_CPU_INTENSIVE, true);

spin_unlock_irq(&gcwq->lock);

work_clear_pending(work);
Expand All @@ -1713,6 +1723,10 @@ static void process_one_work(struct worker *worker, struct work_struct *work)

spin_lock_irq(&gcwq->lock);

/* clear cpu intensive status */
if (unlikely(cpu_intensive))
worker_clr_flags(worker, WORKER_CPU_INTENSIVE);

/* we're done with it, release */
hlist_del_init(&worker->hentry);
worker->current_work = NULL;
Expand Down

0 comments on commit 41814b5

Please sign in to comment.