linux-2.6.33/__create_workqueue_key()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#hb49f591]
#backlinks
*説明 [#o176a6d1]
-パス: [[linux-2.6.33/kernel/workqueue.c]]
-FIXME: これは何?
--説明
**引数 [#t6eba761]
-const char *name
--ワークキューの名前。
-int singlethread
--
-int freezeable
--
-int rt
--
-struct lock_class_key *key
--
--[[linux-2.6.33/lock_class_key]]
-const char *lock_name
--
**返り値 [#nfef0904]
-struct workqueue_struct *
--ワークキューへのポインタ。失敗したときは NULL。
**参考 [#z031b8b9]
*実装 [#ja84f510]
struct workqueue_struct *__create_workqueue_key(const ch...
int singlethread,
int freezeable,
int rt,
struct lock_class_key *key,
const char *lock_name)
{
struct workqueue_struct *wq;
struct cpu_workqueue_struct *cwq;
int err = 0, cpu;
-
--[[linux-2.6.33/workqueue_struct]]
-
--[[linux-2.6.33/cpu_workqueue_struct]]
wq = kzalloc(sizeof(*wq), GFP_KERNEL);
if (!wq)
return NULL;
-
--[[linux-2.6.33/GFP_KERNEL]]
-
--[[linux-2.6.33/kzalloc()]]
wq->cpu_wq = alloc_percpu(struct cpu_workqueue_struct);
if (!wq->cpu_wq) {
kfree(wq);
return NULL;
}
-
--[[linux-2.6.33/alloc_percpu()]]
wq->name = name;
lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
wq->singlethread = singlethread;
wq->freezeable = freezeable;
wq->rt = rt;
INIT_LIST_HEAD(&wq->list);
-
--[[linux-2.6.33/lockdep_init_map()]]
-
--[[linux-2.6.33/INIT_LIST_HEAD()]]
if (singlethread) {
cwq = init_cpu_workqueue(wq, singlethread_cpu);
err = create_workqueue_thread(cwq, singlethread_cpu);
start_workqueue_thread(cwq, -1);
-singlethread_cpu は、static 変数、int 型
-
--[[linux-2.6.33/init_cpu_workqueue()]]
-
--[[linux-2.6.33/create_workqueue_thread()]]
-
--[[linux-2.6.33/start_workqueue_thread()]]
} else {
cpu_maps_update_begin();
-
--[[linux-2.6.33/cpu_maps_update_begin()]]
/*
* We must place this wq on list even if the code belo...
* cpu_down(cpu) can remove cpu from cpu_populated_map...
* destroy_workqueue() takes the lock, in that case we...
* cwq[cpu]->thread.
*/
spin_lock(&workqueue_lock);
list_add(&wq->list, &workqueues);
spin_unlock(&workqueue_lock);
-
--[[linux-2.6.33/spin_lock()]]
-
--[[linux-2.6.33/list_add()]]
-
--[[linux-2.6.33/spin_unlock()]]
/*
* We must initialize cwqs for each possible cpu even ...
* are going to call destroy_workqueue() finally. Othe...
* cpu_up() can hit the uninitialized cwq once we drop...
* lock.
*/
for_each_possible_cpu(cpu) {
-
--[[linux-2.6.33/for_each_possible_cpu()]]
cwq = init_cpu_workqueue(wq, cpu);
if (err || !cpu_online(cpu))
continue;
-
--[[linux-2.6.33/init_cpu_workqueue()]]
-
--[[linux-2.6.33/cpu_online()]]
err = create_workqueue_thread(cwq, cpu);
start_workqueue_thread(cwq, cpu);
-
--[[linux-2.6.33/create_workqueue_thread()]]
-
--[[linux-2.6.33/start_workqueue_thead()]]
}
cpu_maps_update_done();
-
--[[linux-2.6.33/cpu_maps_update_done()]]
}
if (err) {
destroy_workqueue(wq);
wq = NULL;
}
-
--[[linux-2.6.33/destroy_workqueue()]]
return wq;
}
EXPORT_SYMBOL_GPL(__create_workqueue_key);
-GPL のモジュールにのみシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL_GPL()]]
*コメント [#z3ccee47]
終了行:
*参照元 [#hb49f591]
#backlinks
*説明 [#o176a6d1]
-パス: [[linux-2.6.33/kernel/workqueue.c]]
-FIXME: これは何?
--説明
**引数 [#t6eba761]
-const char *name
--ワークキューの名前。
-int singlethread
--
-int freezeable
--
-int rt
--
-struct lock_class_key *key
--
--[[linux-2.6.33/lock_class_key]]
-const char *lock_name
--
**返り値 [#nfef0904]
-struct workqueue_struct *
--ワークキューへのポインタ。失敗したときは NULL。
**参考 [#z031b8b9]
*実装 [#ja84f510]
struct workqueue_struct *__create_workqueue_key(const ch...
int singlethread,
int freezeable,
int rt,
struct lock_class_key *key,
const char *lock_name)
{
struct workqueue_struct *wq;
struct cpu_workqueue_struct *cwq;
int err = 0, cpu;
-
--[[linux-2.6.33/workqueue_struct]]
-
--[[linux-2.6.33/cpu_workqueue_struct]]
wq = kzalloc(sizeof(*wq), GFP_KERNEL);
if (!wq)
return NULL;
-
--[[linux-2.6.33/GFP_KERNEL]]
-
--[[linux-2.6.33/kzalloc()]]
wq->cpu_wq = alloc_percpu(struct cpu_workqueue_struct);
if (!wq->cpu_wq) {
kfree(wq);
return NULL;
}
-
--[[linux-2.6.33/alloc_percpu()]]
wq->name = name;
lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
wq->singlethread = singlethread;
wq->freezeable = freezeable;
wq->rt = rt;
INIT_LIST_HEAD(&wq->list);
-
--[[linux-2.6.33/lockdep_init_map()]]
-
--[[linux-2.6.33/INIT_LIST_HEAD()]]
if (singlethread) {
cwq = init_cpu_workqueue(wq, singlethread_cpu);
err = create_workqueue_thread(cwq, singlethread_cpu);
start_workqueue_thread(cwq, -1);
-singlethread_cpu は、static 変数、int 型
-
--[[linux-2.6.33/init_cpu_workqueue()]]
-
--[[linux-2.6.33/create_workqueue_thread()]]
-
--[[linux-2.6.33/start_workqueue_thread()]]
} else {
cpu_maps_update_begin();
-
--[[linux-2.6.33/cpu_maps_update_begin()]]
/*
* We must place this wq on list even if the code belo...
* cpu_down(cpu) can remove cpu from cpu_populated_map...
* destroy_workqueue() takes the lock, in that case we...
* cwq[cpu]->thread.
*/
spin_lock(&workqueue_lock);
list_add(&wq->list, &workqueues);
spin_unlock(&workqueue_lock);
-
--[[linux-2.6.33/spin_lock()]]
-
--[[linux-2.6.33/list_add()]]
-
--[[linux-2.6.33/spin_unlock()]]
/*
* We must initialize cwqs for each possible cpu even ...
* are going to call destroy_workqueue() finally. Othe...
* cpu_up() can hit the uninitialized cwq once we drop...
* lock.
*/
for_each_possible_cpu(cpu) {
-
--[[linux-2.6.33/for_each_possible_cpu()]]
cwq = init_cpu_workqueue(wq, cpu);
if (err || !cpu_online(cpu))
continue;
-
--[[linux-2.6.33/init_cpu_workqueue()]]
-
--[[linux-2.6.33/cpu_online()]]
err = create_workqueue_thread(cwq, cpu);
start_workqueue_thread(cwq, cpu);
-
--[[linux-2.6.33/create_workqueue_thread()]]
-
--[[linux-2.6.33/start_workqueue_thead()]]
}
cpu_maps_update_done();
-
--[[linux-2.6.33/cpu_maps_update_done()]]
}
if (err) {
destroy_workqueue(wq);
wq = NULL;
}
-
--[[linux-2.6.33/destroy_workqueue()]]
return wq;
}
EXPORT_SYMBOL_GPL(__create_workqueue_key);
-GPL のモジュールにのみシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL_GPL()]]
*コメント [#z3ccee47]
ページ名: