お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2012-02-15 00:41:49

a-wada
メンバ
登録日: 2011-10-14

ubuntu 11.10 で dual core の片方を kworker に占拠される?

ubuntu 11.10 上で gcc-4.6.1 & gmp-5.0.4 を使って円周率の計算プログラムを動かしています。
11.10 に更新してから、OpenMp による並列処理の効果が殆ど殺されているので、system-monitor や
top で見てみると kworker/0:0 /0:1 /0:2 等が 70 - 80 % の cpu を占拠し、これまで 190% 以上
アプリで使用していたのが 100% 以下に落ちています。 kworkar を kill -9 sysid で強制終了させても
新しい sysid で立ち上って来て、効果ありません。対処方法を教えて下さい。
そもそも kworker とは何ですか。ググっても的確な回答は得られません。バグですか?

オフライン

 

#2 2012-02-21 15:17:38

udooon
メンバ
登録日: 2012-01-24

Re: ubuntu 11.10 で dual core の片方を kworker に占拠される?

/usr/src/linux-source-3.0.0/Documentation/workqueue.txt
より抜粋

7. Debugging

Because the work functions are executed by generic worker threads
there are a few tricks needed to shed some light on misbehaving
workqueue users.

Worker threads show up in the process list as:

root      5671  0.0  0.0      0     0 ?        S    12:07   0:00 [kworker/0:1]
root      5672  0.0  0.0      0     0 ?        S    12:07   0:00 [kworker/1:2]
root      5673  0.0  0.0      0     0 ?        S    12:12   0:00 [kworker/0:0]
root      5674  0.0  0.0      0     0 ?        S    12:13   0:00 [kworker/1:0]

If kworkers are going crazy (using too much cpu), there are two types
of possible problems:

    1. Something beeing scheduled in rapid succession
    2. A single work item that consumes lots of cpu cycles

The first one can be tracked using tracing:

    $ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event
    $ cat /sys/kernel/debug/tracing/trace_pipe > out.txt
    (wait a few secs)
    ^C

If something is busy looping on work queueing, it would be dominating
the output and the offender can be determined with the work item
function.

For the second type of problems it should be possible to just check
the stack trace of the offending worker thread.

    $ cat /proc/THE_OFFENDING_KWORKER/stack

The work item's function should be trivially visible in the stack
trace.

英語なのでよく解りませんが、なにかシステムに問題があるのかも? です。
(どなたか翻訳を)

オフライン

 

#3 2012-02-22 18:44:22

a-wada
メンバ
登録日: 2011-10-14

Re: ubuntu 11.10 で dual core の片方を kworker に占拠される?

udooon さん、 お返事有難うございます。

 workqueue.txt の全文を読めるように linux-source-3.0.0 をダウンロード・解凍して、
所々辞書を引きながら斜め読みしましたが、kworker が何をしようとしているかは、
朧気に判ったような気がします。

又、 "kworkers are going crazy" の状況を確かめるため、
3個の端末を立上げ、 1個めで "top" を、2個めで OpenMP で並列処理している円周率計算アプリ
"cbm1" を走らせ、3個めで状況把握の コマンド を入力するようにして、待機しました。
スタートして暫くはアプリの cpu 198% が続きます。

この時のスナップショットは http://a-wada.s30.xrea.com/xxknl/Screenshot-2012-02-22-13-16-08.png

約5分経過後に kworker の cpu 83% が現れ アプリは 100% 前後に落ちます。。

この時のスナップショットは http://a-wada.s30.xrea.com/xxknl/Screenshot-2012-02-22-13-17-41.png
                                     http://a-wada.s30.xrea.com/xxknl/Screenshot-2012-02-22-13-19-05.png
                                     http://a-wada.s30.xrea.com/xxknl/Screenshot-2012-02-22-13-35-57.png
     に アップ します。
3個目の端末で

a-wada:~/pai$
a-wada:~/pai$ sudo su -c 'echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event'
[sudo] password for a-wada:
a-wada:~/pai$ sudo su -c 'cat /sys/kernel/debug/tracing/trace_pipe > out.txt'
^C
a-wada:~/pai$ ll out*
-rw-r--r-- 1 root root 23032133 2012-02-22 13:30 out.txt
a-wada:~/pai$ sudo su -c 'cat /proc/THE_OFFENDING_KWORKER/stack > out2.txt'
cat: /proc/THE_OFFENDING_KWORKER/stack: そのようなファイルやディレクトリはありません
a-wada:~/pai$ a-wada:~/pai$ ll out*
-rw-r--r-- 1 root root 23032133 2012-02-22 13:30 out.txt
-rw-r--r-- 1 root root        0 2012-02-22 13:33 out2.txt
a-wada:~/pai$

out.txt の内容は http://a-wada.s30.xrea.com/xxknl/out.txt
    に アップ します。(でっかいです 23.0MB ・・・ 1,2,3,4,5 で ctrl-C したのですが)

このうち最初の 124 行はアプリを走らせる前にテストしたときのものがクリアされてないようです。

このファイルの読み方が判りませんので、どう対処して良いものか さっぱり ですが、
読める人が読めば 何か 判るかも知れませんね。

かなり(2年ほど)前から問題になっているらしく、いろんな対処方が ググ れますが、
此方に適応するもには、ぶつかりません。

どなたか、判る人ありませんか。 ???

オフライン

 

#4 2012-02-23 00:23:14

a-wada
メンバ
登録日: 2011-10-14

Re: ubuntu 11.10 で dual core の片方を kworker に占拠される?

追伸。 済みません、前の投稿の読みにくい所の修正です。
{1}
a-wada:~/pai$
a-wada:~/pai$ ll out*
-rw-r--r-- 1 root root 23032133 2012-02-22 13:30 out.txt
{2}
out.txt の内容は  http://a-wada.s30.xrea.com/xxknl/out.txt
{3}
此方に適応するものには、ぶつかりません。

以上

オフライン

 

Board footer

Powered by FluxBB