Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350279
b: refs/heads/master
c: 715b06b
h: refs/heads/master
i:
  350277: 87f448d
  350275: a7c5226
  350271: 9a90fc1
v: v3
  • Loading branch information
Tejun Heo committed Jan 24, 2013
1 parent 738ba92 commit 121906a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 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: 35b6bb63b8a288f90e07948867941a553b3d97bc
refs/heads/master: 715b06b864c99a18cb8368dfb187da4f569788cd
10 changes: 9 additions & 1 deletion trunk/include/linux/workqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,21 @@ enum {

WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE),

/*
* When a work item is off queue, its high bits point to the last
* cpu it was on. Cap at 31 bits and use the highest number to
* indicate that no cpu is associated.
*/
WORK_OFFQ_FLAG_BITS = 1,
WORK_OFFQ_CPU_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS,
WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_CPU_SHIFT,
WORK_OFFQ_CPU_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31,
WORK_OFFQ_CPU_NONE = (1LU << WORK_OFFQ_CPU_BITS) - 1,

/* convenience constants */
WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
WORK_STRUCT_NO_CPU = (unsigned long)WORK_CPU_NONE << WORK_OFFQ_CPU_SHIFT,
WORK_STRUCT_NO_CPU = (unsigned long)WORK_OFFQ_CPU_NONE << WORK_OFFQ_CPU_SHIFT,

/* bit mask for work_busy() return values */
WORK_BUSY_PENDING = 1 << 0,
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static struct global_cwq *get_work_gcwq(struct work_struct *work)
(data & WORK_STRUCT_WQ_DATA_MASK))->pool->gcwq;

cpu = data >> WORK_OFFQ_CPU_SHIFT;
if (cpu == WORK_CPU_NONE)
if (cpu == WORK_OFFQ_CPU_NONE)
return NULL;

BUG_ON(cpu >= nr_cpu_ids && cpu != WORK_CPU_UNBOUND);
Expand All @@ -583,7 +583,7 @@ static struct global_cwq *get_work_gcwq(struct work_struct *work)
static void mark_work_canceling(struct work_struct *work)
{
struct global_cwq *gcwq = get_work_gcwq(work);
unsigned long cpu = gcwq ? gcwq->cpu : WORK_CPU_NONE;
unsigned long cpu = gcwq ? gcwq->cpu : WORK_OFFQ_CPU_NONE;

set_work_data(work, (cpu << WORK_OFFQ_CPU_SHIFT) | WORK_OFFQ_CANCELING,
WORK_STRUCT_PENDING);
Expand Down

0 comments on commit 121906a

Please sign in to comment.