胸騒ぎ

Pavelから久々にLKMLに返信がきた。

> On Mon 2009-04-13 11:04:19, Tetsuo Handa wrote:
> Hello.
>
>> Pavel Machek wrote:
>> > Could we get an user<->kernel interface documentation?
>>
>> It is at http://tomoyo.sourceforge.jp/en/2.2.x/policy-reference.html.

Ouch:

> In TOMOYO Linux, memory allocated for holding access permissions and
> words are never freed. There is no way except rebooting the system
> that can free unneeded memory.
>
> But don't worry. The policy seldom changes after you start production
> mode. By tuning policy before starting production mode, you can reduce
> memory usage to (usually) less than 1 MB.

....does that mean that it leaks memory by design?

TOMOYOのドキュメントを引用し、「これはメモリーリークをするように設計しているということか?」と質問してきている。熊猫先生はもう帰宅していたので、先生に自分の考えを簡単にメールしておいた。

Pavelの返答ですが、『学習モードではメモリ使用量は増加するが、強制モードでは単調には増加しない。強制モードで使うメモリはポリシーを保持するためのものでそれはリークとは違う』のようになると思っています。ドキュメントに書いてある"Don't worry"ですが、『容量が小さい(から問題ない)』はこれまでの議論で彼らには通用しないと思っているので、返答では含めない方が良いです。

その後会社で会ったときにも同じことを伝えたのだが、先生からは特に返信も返事がない。無視できる質問ではないし、どうするのかなと思っていたら、LKMLで熊猫先生がPavelに送った返事を見つけた。

Sorry for delayed response.

> Pavel Machek wrote:
>> 2.5 Memory Allocation Rules
>>
>> In TOMOYO Linux, memory allocated for holding access permissions and
>> words are never freed. There is no way except rebooting the system
>> that can free unneeded memory.
>>
>> But don't worry. The policy seldom changes after you start production
>> mode. By tuning policy before starting production mode, you can reduce
>> memory usage to (usually) less than 1 MB.
>
> ....does that mean that it leaks memory by design?

This is memory leak, but *controlled* memory allocation with a strategy for
avoiding memory fragmentation and reducing memory usage. kstrdup()ing string
data produces partially unused memory block since string data's length is
unlikely power of two. Therefore, TOMOYO allocates memory in PAGE_SIZE bytes
block and embeds string data as much as possible.
TOMOYO does not continue allocating forever.

自分の直感は、「メモリーリークです」と認めることは避けるべきだと告げていて、だからこそ意見を伝えておいたのだが、先生は開口一番「これはメモリリークだ」と認める、正反対の返答を返していたのだ。これには驚いた。

もし自分の考えが正しければ、これこそがPavelが言わせたかった言葉であり、そして、Pavelがそれを言わせたい理由はひとつで「メインラインとして不適切(だから排除すべき)」ということしかない。書いた気持ちというか考え方は理解できて、「意味的にはメモリリークだから」ということだと思ったが、最初の一言で「そう。これはメモリリークだ」と返している印象は強すぎる。その後でいくら事情や理由を書いたとしても挽回できない。これからの提案や議論にも不利に作用することだろう。

いずれにしても賽は投げられ、Pavelのターンになった。送られたメールはもう取り消せない。これまでも数多くの難しい局面があったが、この返答を見て今までにない胸騒ぎをおぼえた。胸騒ぎが現実のものにならなければ良いと思う。