1 .\" This is _*_ nroff _*_ source. Emacs, gimme all those colors :)
3 .\" Copyright (c) International Business Machines orp., 2006
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" This program is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 .\" the GNU General Public License for more details.
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program; if not, write to the Free Software
17 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 .\" 2006-04-27, created by Eduardo M. Fleury <efleury@br.ibm.com>
22 .\" with various additions by Michael Kerrisk <mtk.manpages@gmail.com>
24 .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI
25 .\" all rights reserved.
26 .\" Translated 2007-01-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
27 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
29 .TH IOPRIO_SET 2 2008-07-09 "Linux" "Linux Programmer's Manual"
32 .\"O ioprio_get, ioprio_set \- get/set I/O scheduling class and priority
33 ioprio_get, ioprio_set \- I/O スケジューリングクラスと優先度の設定/取得
37 .BI "int ioprio_get(int " which ", int " who );
38 .BI "int ioprio_set(int " which ", int " who ", int " ioprio );
43 .\"O .BR ioprio_get ()
45 .\"O .BR ioprio_set ()
46 .\"O system calls respectively get and set the I/O scheduling class and
47 .\"O priority of one or more processes.
52 は、(1つ以上の) プロセスの I/O スケジューリングクラスと
59 .\"O arguments identify the process(es) on which the system
63 .\"O argument determines how
65 .\"O is interpreted, and has one of the following values:
69 引き数でシステムコールの操作対象となるプロセスを指示する。
73 をどのように解釈するかを決めるもので、以下のいずれか一つを指定する。
77 .\"O is a process ID identifying a single process.
79 はプロセスID であり、指定された 1 プロセスが対象となる。
83 .\"O is a process group ID identifying all the members of a process group.
85 はプロセスグループID であり、プロセスグループの全メンバが対象となる。
89 .\"O is a user ID identifying all of the processes that
90 .\"O have a matching real UID.
92 はユーザID であり、実 UID に一致する全プロセスが対象となる。
97 .\"O .B IOPRIO_WHO_PGRP
99 .\"O .B IOPRIO_WHO_USER
101 .\"O .BR ioprio_get (),
102 .\"O and more than one process matches
104 .\"O then the returned priority will be the highest one found among
105 .\"O all of the matching processes.
106 .\"O One priority is said to be
107 .\"O higher than another one if it belongs to a higher priority
109 .\"O .RB ( IOPRIO_CLASS_RT
110 .\"O is the highest priority class;
111 .\"O .B IOPRIO_CLASS_IDLE
113 .\"O or if it belongs to the same priority class as the other process but
114 .\"O has a higher priority level (a lower priority number means a
115 .\"O higher priority level).
126 一致するプロセス全体の中で最も高い優先度が返される。
127 優先度が高いとは、より高い優先度クラスに属している
128 .RB ( IOPRIO_CLASS_RT
132 同じ優先度クラスに属しているが優先度レベルが高い
133 (優先度番号が小さい方が優先度レベルが高いことを意味する)、
138 .\"O argument given to
139 .\"O .BR ioprio_set ()
140 .\"O is a bit mask that specifies both the scheduling class and the
141 .\"O priority to be assigned to the target process(es).
142 .\"O The following macros are used for assembling and dissecting
148 引き数は、対象となるプロセスに割り当てるスケジューリングクラスと
149 優先度の両方を指定するビットマスクである。
151 の値を組み立てたり解釈するのに、以下のマクロが利用できる。
153 .BI IOPRIO_PRIO_VALUE( class ", " data )
154 .\"O Given a scheduling
158 .\"O this macro combines the two values to produce an
160 .\"O value, which is returned as the result of the macro.
165 を与えると、このマクロは 2つの値を組み合わせて、
169 .BI IOPRIO_PRIO_CLASS( mask )
174 .\"O value), this macro returns its I/O class component, that is,
175 .\"O one of the values
176 .\"O .BR IOPRIO_CLASS_RT ,
177 .\"O .BR IOPRIO_CLASS_BE ,
179 .\"O .BR IOPRIO_CLASS_IDLE .
182 値) を与えると、このマクロは I/O クラス要素、つまり
183 .BR IOPRIO_CLASS_RT ,
184 .BR IOPRIO_CLASS_BE ,
188 .BI IOPRIO_PRIO_DATA( mask )
193 .\"O value), this macro returns its priority
202 .\"O See the NOTES section for more
203 .\"O information on scheduling classes and priorities.
204 スケジューリングクラスと優先度に関する詳しい情報は、
207 .\"O I/O priorities are supported for reads and for synchronous
208 .\"O .RB ( O_DIRECT ,
211 .\"O I/O priorities are not supported for asynchronous
212 .\"O writes because they are issued outside the context of the program
213 .\"O dirtying the memory, and thus program-specific priorities do not apply.
218 I/O 優先度は非同期書き込みには対応していない。なぜなら、
219 非同期書き込みはメモリ書き換えを行うプログラムの動作 (context) とは
220 関係なく発行され、そのためプログラム単位の優先度は適用されないから
222 .\"O .SH "RETURN VALUE"
225 .\"O .BR ioprio_get ()
228 .\"O value of the process with highest I/O priority of any of the processes
229 .\"O that match the criteria specified in
233 .\"O On error, \-1 is returned, and
235 .\"O is set to indicate the error.
242 で指定された基準に合致した全プロセスで最も高い I/O 優先度を持つプロセスの
250 .\"O .BR ioprio_set ()
252 .\"O On error, \-1 is returned, and
254 .\"O is set to indicate the error.
265 .\"O Invalid value for
269 .\"O Refer to the NOTES section for available scheduler
270 .\"O classes and priority levels for
277 用に指定可能なスケジューラクラスと優先度レベルについては
281 .\"O The calling process does not have the privilege needed to assign this
283 .\"O to the specified process(es).
284 .\"O See the NOTES section for more information on required
286 .\"O .BR ioprio_set ().
287 呼び出し元プロセスが、指定されたプロセスに
289 を割り当てるのに必要な権限を持っていない。
291 に必要な権限についての詳しい情報は「備考」の節を参照のこと。
294 .\"O No process(es) could be found that matched the specification in
301 で指定された基準に合致するプロセスが見つからなかった。
304 .\"O These system calls have been available on Linux since
306 これらのシステムコールはカーネル 2.6.13 以降の Linux で利用可能である。
307 .\"O .SH "CONFORMING TO"
309 .\"O These system calls are Linux-specific.
310 これらのシステムコールは Linux 独自である。
313 .\"O Glibc does not provide wrapper for these system calls; call them using
314 .\"O .BR syscall (2).
315 glibc はこれらのシステムコールに対するラッパー関数を提供していない。
319 .\"O These system calls only have an effect when used
320 .\"O in conjunction with an I/O scheduler that supports I/O priorities.
321 .\"O As at kernel 2.6.17 the only such scheduler is the Completely Fair Queuing
322 .\"O (CFQ) I/O scheduler.
323 これらのシステムコールは、I/O 優先度に対応した I/O スケジューラと
324 組み合わせて使用された場合にのみ効果を持つ。
325 カーネル 2.6.17 では、この条件を満たすスケジューラは
326 Completely Fair Queuing (CFQ) I/O スケジューラだけである。
327 .\"O .SS "Selecting an I/O Scheduler"
329 .\"O I/O Schedulers are selected on a per-device basis via the special
331 .\"O .IR /sys/block/<device>/queue/scheduler .
332 I/O スケジューラの選択はデバイス単位に行われ、その選択は
334 .I /sys/block/<device>/queue/scheduler
337 .\"O One can view the current I/O scheduler via the
340 .\"O For example, the following command
341 .\"O displays a list of all schedulers currently loaded in the kernel:
344 ファイルシステム経由で参照できる。例えば、以下のコマンドを実行すると、
345 現在カーネルでロードされているスケジューラの全リストが表示される。
349 .RB "$" " cat /sys/block/hda/queue/scheduler"
350 noop anticipatory deadline [cfq]
354 .\"O The scheduler surrounded by brackets is the one actually
355 .\"O in use for the device
357 .\"O in the example).
358 括弧で囲まれたスケジューラがそのデバイス (上の例では
360 について実際に使用されているスケジューラである。
361 .\"O Setting another scheduler is done by writing the name of the
362 .\"O new scheduler to this file.
363 .\"O For example, the following command will set the
364 .\"O scheduler for the
368 別のスケジューラを設定するには、このファイルに新しいスケジューラ名を
369 書き込めばよい。例えば、以下のコマンドを実行すると、デバイス
379 .RB "#" " echo cfq > /sys/block/hda/queue/scheduler"
382 .\"O .SS "The Completely Fair Queuing (CFQ) I/O Scheduler"
383 .SS "Completely Fair Queuing (CFQ) I/O スケジューラ"
384 .\"O Since v3 (aka CFQ Time Sliced) CFQ implements
385 .\"O I/O nice levels similar to those
386 .\"O of CPU scheduling.
387 .\"O These nice levels are grouped in three scheduling classes
388 .\"O each one containing one or more priority levels:
389 バージョン 3 (別名 CFQ Time Sliced) 以降、
390 CPU スケジューリングと同様の I/O nice レベルが CFQ に実装されている。
391 これらの nice レベルは 3つのスケジューリングクラスに分類でき、
392 各スケジューリングクラスにつき 1つ以上の優先度レベルが定義されている。
394 .BR IOPRIO_CLASS_RT " (1)"
395 .\"O This is the real-time I/O class.
396 .\"O This scheduling class is given
397 .\"O higher priority than any other class:
398 .\"O processes from this class are
399 .\"O given first access to the disk every time.
400 .\"O Thus this I/O class needs to be used with some
401 .\"O care: one I/O real-time process can starve the entire system.
402 .\"O Within the real-time class,
403 .\"O there are 8 levels of class data (priority) that determine exactly
404 .\"O how much time this process needs the disk for on each service.
405 .\"O The highest real-time priority level is 0; the lowest is 7.
406 .\"O In the future this might change to be more directly mappable to
407 .\"O performance, by passing in a desired data rate instead.
408 これはリアルタイム I/O クラスである。
409 このスケジューリングクラスには他のクラスよりも高い優先度が与えられる。
410 このクラスのプロセスには、常にディスクへのアクセスが優先して
411 割り当てられる。そのため、この I/O クラスを使う際には、
412 たった一つの リアルタイム I/O クラスのプロセスにより
413 システム全体のディスクアクセスができなくなってしまうことがある
415 このクラスには、8 段階の class data (優先度レベル) がある。
416 この値は、そのプロセスが 1回のディスクアクセスにどれだけの
417 時間が必要かを正確に決めるためのものである。
418 最高のリアルタイム優先度レベルは 0 で、最低は 7 である。
419 将来的には、優先度レベルは、希望するデータレートを渡すなど、
420 より直接的に性能条件を反映できるように変更されるかもしれない。
422 .BR IOPRIO_CLASS_BE " (2)"
423 .\"O This is the best-effort scheduling class,
424 .\"O which is the default for any process
425 .\"O that hasn't set a specific I/O priority.
426 .\"O The class data (priority) determines how much
427 .\"O I/O bandwidth the process will get.
428 .\"O Best-effort priority levels are analogous to CPU nice values
430 .\"O .BR getpriority (2)).
431 .\"O The priority level determines a priority relative
432 .\"O to other processes in the best-effort scheduling class.
433 .\"O Priority levels range from 0 (highest) to 7 (lowest).
434 これは ベストエフォート・スケジューリングクラスである。
435 このクラスは、特定の I/O 優先度を設定していないプロセスの
437 class data (優先度レベル) により、そのプロセスがどの程度の
439 ベストエフォート・優先度レベルは、CPU の nice 値
440 .RB ( getpriority (2)
442 優先度レベルは、ベストエフォート・スケジューリングクラスの中で
443 他のプロセスとの相対的な優先度を決定する。
444 優先度レベルの値の範囲は 0 (最高) から 7 (最低) である。
446 .BR IOPRIO_CLASS_IDLE " (3)"
447 .\"O This is the idle scheduling class.
448 .\"O Processes running at this level only get I/O
449 .\"O time when no-one else needs the disk.
450 .\"O The idle class has no class data.
451 .\"O Attention is required when assigning this priority class to a process,
452 .\"O since it may become starved if higher priority processes are
453 .\"O constantly accessing the disk.
454 これは idle スケジューリングクラスである。
455 このレベルで動作するプロセスは他にディスクアクセスをしようとする
456 プロセスがない場合にのみ I/O 時間を取得する。
457 idle クラスには class data (優先度) は用意されていない。
458 プロセスにこの優先度を割り当てる際には注意が必要である。
459 なぜなら、優先度の高いプロセスが常にディスクにアクセスしている場合には
460 ディスクにアクセスできなくなる可能性があるからだ。
463 .\"O .I Documentation/block/ioprio.txt
464 .\"O for more information on the CFQ I/O Scheduler and an example program.
465 CFQ I/O スケジューラの更なる情報とサンプルプログラムについては
466 .I Documentation/block/ioprio.txt
468 .\"O .SS "Required permissions to set I/O priorities"
469 .SS "I/O 優先度の設定に必要な許可"
470 .\"O Permission to change a process's priority is granted or denied based
471 .\"O on two assertions:
472 プロセスの優先度を変更する許可が得られるかどうかは
475 .\"O .B "Process ownership"
477 .\"O An unprivileged process may only set the I/O priority of a process
479 .\"O matches the real or effective UID of the calling process.
480 .\"O A process which has the
482 .\"O capability can change the priority of any process.
483 非特権プロセスは、プロセスの実 UID が呼び出し元プロセスの実 UID もしくは
484 実効 UID と一致するプロセスの I/O 優先度のみを設定できる。
486 ケーパビリティを持つプロセスは、どのプロセスの優先度でも変更できる。
488 .\"O .B "What is the desired priority"
489 .B "どの優先度に設定しようとしているか"
490 .\"O Attempts to set very high priorities
491 .\"O .RB ( IOPRIO_CLASS_RT )
493 .\"O .B CAP_SYS_ADMIN
496 .RB ( IOPRIO_CLASS_RT )
500 .\"O Kernel versions up to 2.6.24 also required
501 .\"O .B CAP_SYS_ADMIN
502 .\"O to set a very low priority
503 .\"O .RB ( IOPRIO_CLASS_IDLE ),
504 .\"O but since Linux 2.6.25, this is no longer required.
505 カーネル 2.6.24 以前では、非常に低い優先度
506 .RB ( IOPRIO_CLASS_IDLE )
510 Linux 2.6.25 以降ではもはや必要なくなった。
513 .\"O .BR ioprio_set ()
514 .\"O must follow both rules, or the call will fail with the error
517 はこの両方のルールに従い、条件を満たさない場合、エラー
522 .\" 6 May 07: Bug report raised:
523 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=4464
524 .\" Ulrich Drepper replied that he wasn't going to add these
526 .\"O Glibc does not yet provide a suitable header file defining
527 .\"O the function prototypes and macros described on this page.
528 .\"O Suitable definitions can be found in
529 .\"O .IR linux/ioprio.h .
530 glibc は、このページに記載された関数プロトタイプやマクロを定義する
531 適切なヘッダファイルをまだ提供していない。
541 .\"O Documentation/block/ioprio.txt in the kernel source tree.
542 カーネル・ソース内の Documentation/block/ioprio.txt