Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316725
b: refs/heads/master
c: 9a2e03d
h: refs/heads/master
i:
  316723: 8f373b3
v: v3
  • Loading branch information
Tejun Heo committed Jul 22, 2012
1 parent be8e772 commit b75bcf3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 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: 8db25e7891a47e03db6f04344a9c92be16e391bb
refs/heads/master: 9a2e03d8ed518a61154f18d83d6466628e519f94
42 changes: 26 additions & 16 deletions trunk/kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,19 @@ int kthread_worker_fn(void *worker_ptr)
}
EXPORT_SYMBOL_GPL(kthread_worker_fn);

/* insert @work before @pos in @worker */
static void insert_kthread_work(struct kthread_worker *worker,
struct kthread_work *work,
struct list_head *pos)
{
lockdep_assert_held(&worker->lock);

list_add_tail(&work->node, pos);
work->queue_seq++;
if (likely(worker->task))
wake_up_process(worker->task);
}

/**
* queue_kthread_work - queue a kthread_work
* @worker: target kthread_worker
Expand All @@ -395,17 +408,26 @@ bool queue_kthread_work(struct kthread_worker *worker,

spin_lock_irqsave(&worker->lock, flags);
if (list_empty(&work->node)) {
list_add_tail(&work->node, &worker->work_list);
work->queue_seq++;
if (likely(worker->task))
wake_up_process(worker->task);
insert_kthread_work(worker, work, &worker->work_list);
ret = true;
}
spin_unlock_irqrestore(&worker->lock, flags);
return ret;
}
EXPORT_SYMBOL_GPL(queue_kthread_work);

struct kthread_flush_work {
struct kthread_work work;
struct completion done;
};

static void kthread_flush_work_fn(struct kthread_work *work)
{
struct kthread_flush_work *fwork =
container_of(work, struct kthread_flush_work, work);
complete(&fwork->done);
}

/**
* flush_kthread_work - flush a kthread_work
* @work: work to flush
Expand Down Expand Up @@ -436,18 +458,6 @@ void flush_kthread_work(struct kthread_work *work)
}
EXPORT_SYMBOL_GPL(flush_kthread_work);

struct kthread_flush_work {
struct kthread_work work;
struct completion done;
};

static void kthread_flush_work_fn(struct kthread_work *work)
{
struct kthread_flush_work *fwork =
container_of(work, struct kthread_flush_work, work);
complete(&fwork->done);
}

/**
* flush_kthread_worker - flush all current works on a kthread_worker
* @worker: worker to flush
Expand Down

0 comments on commit b75bcf3

Please sign in to comment.