-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linu…
…x-2.6
- Loading branch information
Showing
418 changed files
with
24,630 additions
and
16,666 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
Block io priorities | ||
=================== | ||
|
||
|
||
Intro | ||
----- | ||
|
||
With the introduction of cfq v3 (aka cfq-ts or time sliced cfq), basic io | ||
priorities is supported for reads on files. This enables users to io nice | ||
processes or process groups, similar to what has been possible to cpu | ||
scheduling for ages. This document mainly details the current possibilites | ||
with cfq, other io schedulers do not support io priorities so far. | ||
|
||
Scheduling classes | ||
------------------ | ||
|
||
CFQ implements three generic scheduling classes that determine how io is | ||
served for a process. | ||
|
||
IOPRIO_CLASS_RT: This is the realtime io class. This scheduling class is given | ||
higher priority than any other in the system, processes from this class are | ||
given first access to the disk every time. Thus it needs to be used with some | ||
care, one io RT process can starve the entire system. Within the RT class, | ||
there are 8 levels of class data that determine exactly how much time this | ||
process needs the disk for on each service. In the future this might change | ||
to be more directly mappable to performance, by passing in a wanted data | ||
rate instead. | ||
|
||
IOPRIO_CLASS_BE: This is the best-effort scheduling class, which is the default | ||
for any process that hasn't set a specific io priority. The class data | ||
determines how much io bandwidth the process will get, it's directly mappable | ||
to the cpu nice levels just more coarsely implemented. 0 is the highest | ||
BE prio level, 7 is the lowest. The mapping between cpu nice level and io | ||
nice level is determined as: io_nice = (cpu_nice + 20) / 5. | ||
|
||
IOPRIO_CLASS_IDLE: This is the idle scheduling class, processes running at this | ||
level only get io time when no one else needs the disk. The idle class has no | ||
class data, since it doesn't really apply here. | ||
|
||
Tools | ||
----- | ||
|
||
See below for a sample ionice tool. Usage: | ||
|
||
# ionice -c<class> -n<level> -p<pid> | ||
|
||
If pid isn't given, the current process is assumed. IO priority settings | ||
are inherited on fork, so you can use ionice to start the process at a given | ||
level: | ||
|
||
# ionice -c2 -n0 /bin/ls | ||
|
||
will run ls at the best-effort scheduling class at the highest priority. | ||
For a running process, you can give the pid instead: | ||
|
||
# ionice -c1 -n2 -p100 | ||
|
||
will change pid 100 to run at the realtime scheduling class, at priority 2. | ||
|
||
---> snip ionice.c tool <--- | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <errno.h> | ||
#include <getopt.h> | ||
#include <unistd.h> | ||
#include <sys/ptrace.h> | ||
#include <asm/unistd.h> | ||
|
||
extern int sys_ioprio_set(int, int, int); | ||
extern int sys_ioprio_get(int, int); | ||
|
||
#if defined(__i386__) | ||
#define __NR_ioprio_set 289 | ||
#define __NR_ioprio_get 290 | ||
#elif defined(__ppc__) | ||
#define __NR_ioprio_set 273 | ||
#define __NR_ioprio_get 274 | ||
#elif defined(__x86_64__) | ||
#define __NR_ioprio_set 251 | ||
#define __NR_ioprio_get 252 | ||
#elif defined(__ia64__) | ||
#define __NR_ioprio_set 1274 | ||
#define __NR_ioprio_get 1275 | ||
#else | ||
#error "Unsupported arch" | ||
#endif | ||
|
||
_syscall3(int, ioprio_set, int, which, int, who, int, ioprio); | ||
_syscall2(int, ioprio_get, int, which, int, who); | ||
|
||
enum { | ||
IOPRIO_CLASS_NONE, | ||
IOPRIO_CLASS_RT, | ||
IOPRIO_CLASS_BE, | ||
IOPRIO_CLASS_IDLE, | ||
}; | ||
|
||
enum { | ||
IOPRIO_WHO_PROCESS = 1, | ||
IOPRIO_WHO_PGRP, | ||
IOPRIO_WHO_USER, | ||
}; | ||
|
||
#define IOPRIO_CLASS_SHIFT 13 | ||
|
||
const char *to_prio[] = { "none", "realtime", "best-effort", "idle", }; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int ioprio = 4, set = 0, ioprio_class = IOPRIO_CLASS_BE; | ||
int c, pid = 0; | ||
|
||
while ((c = getopt(argc, argv, "+n:c:p:")) != EOF) { | ||
switch (c) { | ||
case 'n': | ||
ioprio = strtol(optarg, NULL, 10); | ||
set = 1; | ||
break; | ||
case 'c': | ||
ioprio_class = strtol(optarg, NULL, 10); | ||
set = 1; | ||
break; | ||
case 'p': | ||
pid = strtol(optarg, NULL, 10); | ||
break; | ||
} | ||
} | ||
|
||
switch (ioprio_class) { | ||
case IOPRIO_CLASS_NONE: | ||
ioprio_class = IOPRIO_CLASS_BE; | ||
break; | ||
case IOPRIO_CLASS_RT: | ||
case IOPRIO_CLASS_BE: | ||
break; | ||
case IOPRIO_CLASS_IDLE: | ||
ioprio = 7; | ||
break; | ||
default: | ||
printf("bad prio class %d\n", ioprio_class); | ||
return 1; | ||
} | ||
|
||
if (!set) { | ||
if (!pid && argv[optind]) | ||
pid = strtol(argv[optind], NULL, 10); | ||
|
||
ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid); | ||
|
||
printf("pid=%d, %d\n", pid, ioprio); | ||
|
||
if (ioprio == -1) | ||
perror("ioprio_get"); | ||
else { | ||
ioprio_class = ioprio >> IOPRIO_CLASS_SHIFT; | ||
ioprio = ioprio & 0xff; | ||
printf("%s: prio %d\n", to_prio[ioprio_class], ioprio); | ||
} | ||
} else { | ||
if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1) { | ||
perror("ioprio_set"); | ||
return 1; | ||
} | ||
|
||
if (argv[optind]) | ||
execvp(argv[optind], &argv[optind]); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
---> snip ionice.c tool <--- | ||
|
||
|
||
March 11 2005, Jens Axboe <axboe@suse.de> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
Matching of PCMCIA devices to drivers is done using one or more of the | ||
following criteria: | ||
|
||
- manufactor ID | ||
- card ID | ||
- product ID strings _and_ hashes of these strings | ||
- function ID | ||
- device function (actual and pseudo) | ||
|
||
You should use the helpers in include/pcmcia/device_id.h for generating the | ||
struct pcmcia_device_id[] entries which match devices to drivers. | ||
|
||
If you want to match product ID strings, you also need to pass the crc32 | ||
hashes of the string to the macro, e.g. if you want to match the product ID | ||
string 1, you need to use | ||
|
||
PCMCIA_DEVICE_PROD_ID1("some_string", 0x(hash_of_some_string)), | ||
|
||
If the hash is incorrect, the kernel will inform you about this in "dmesg" | ||
upon module initialization, and tell you of the correct hash. | ||
|
||
You can determine the hash of the product ID strings by running | ||
"pcmcia-modalias %n.%m" [%n being replaced with the socket number and %m being | ||
replaced with the device function] from pcmciautils. It generates a string | ||
in the following form: | ||
pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000 | ||
|
||
The hex value after "pa" is the hash of product ID string 1, after "pb" for | ||
string 2 and so on. | ||
|
||
Alternatively, you can use this small tool to determine the crc32 hash. | ||
simply pass the string you want to evaluate as argument to this program, | ||
e.g. | ||
$ ./crc32hash "Dual Speed" | ||
|
||
------------------------------------------------------------------------- | ||
/* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */ | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <ctype.h> | ||
#include <stdlib.h> | ||
|
||
unsigned int crc32(unsigned char const *p, unsigned int len) | ||
{ | ||
int i; | ||
unsigned int crc = 0; | ||
while (len--) { | ||
crc ^= *p++; | ||
for (i = 0; i < 8; i++) | ||
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0); | ||
} | ||
return crc; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
unsigned int result; | ||
if (argc != 2) { | ||
printf("no string passed as argument\n"); | ||
return -1; | ||
} | ||
result = crc32(argv[1], strlen(argv[1])); | ||
printf("0x%x\n", result); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
This file details changes in 2.6 which affect PCMCIA card driver authors: | ||
|
||
* in-kernel device<->driver matching | ||
PCMCIA devices and their correct drivers can now be matched in | ||
kernelspace. See 'devicetable.txt' for details. | ||
|
||
* Device model integration (as of 2.6.11) | ||
A struct pcmcia_device is registered with the device model core, | ||
and can be used (e.g. for SET_NETDEV_DEV) by using | ||
handle_to_dev(client_handle_t * handle). | ||
|
||
* Convert internal I/O port addresses to unsigned long (as of 2.6.11) | ||
ioaddr_t should be replaced by kio_addr_t in PCMCIA card drivers. | ||
|
||
* irq_mask and irq_list parameters (as of 2.6.11) | ||
The irq_mask and irq_list parameters should no longer be used in | ||
PCMCIA card drivers. Instead, it is the job of the PCMCIA core to | ||
determine which IRQ should be used. Therefore, link->irq.IRQInfo2 | ||
is ignored. | ||
|
||
* client->PendingEvents is gone (as of 2.6.11) | ||
client->PendingEvents is no longer available. | ||
|
||
* client->Attributes are gone (as of 2.6.11) | ||
client->Attributes is unused, therefore it is removed from all | ||
PCMCIA card drivers | ||
|
||
* core functions no longer available (as of 2.6.11) | ||
The following functions have been removed from the kernel source | ||
because they are unused by all in-kernel drivers, and no external | ||
driver was reported to rely on them: | ||
pcmcia_get_first_region() | ||
pcmcia_get_next_region() | ||
pcmcia_modify_window() | ||
pcmcia_set_event_mask() | ||
pcmcia_get_first_window() | ||
pcmcia_get_next_window() | ||
|
||
* device list iteration upon module removal (as of 2.6.10) | ||
It is no longer necessary to iterate on the driver's internal | ||
client list and call the ->detach() function upon module removal. | ||
|
||
* Resource management. (as of 2.6.8) | ||
Although the PCMCIA subsystem will allocate resources for cards, | ||
it no longer marks these resources busy. This means that driver | ||
authors are now responsible for claiming your resources as per | ||
other drivers in Linux. You should use request_region() to mark | ||
your IO regions in-use, and request_mem_region() to mark your | ||
memory regions in-use. The name argument should be a pointer to | ||
your driver name. Eg, for pcnet_cs, name should point to the | ||
string "pcnet_cs". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.