Re: [PATCH] Time sliced cfq with basic io priorities

From: Jens Axboe
Date: Mon Dec 13 2004 - 08:12:15 EST


On Mon, Dec 13 2004, Jens Axboe wrote:
> 2.6.10-rc2-mm4 patch:

So 2.6.10-rc3-mm1 is out I notice, here's a patch for that:

http://www.kernel.org/pub/linux/kernel/people/axboe/patches/v2.6/2.6.10-rc3-mm1/cfq-time-slices-10-2.6.10-rc3-mm1.gz

And an updated ionice.c attached, the syscall numbers changed.

--
Jens Axboe

#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);
extern int sys_ioprio_get(void);

#if defined(__i386__)
#define __NR_ioprio_set 294
#define __NR_ioprio_get 295
#elif defined(__ppc__)
#define __NR_ioprio_set 277
#define __NR_ioprio_get 278
#elif defined(__x86_64__)
#define __NR_ioprio_set 254
#define __NR_ioprio_get 255
#elif defined(__ia64__)
#define __NR_ioprio_set 1274
#define __NR_ioprio_get 1275
#else
#error "Unsupported arch"
#endif

_syscall1(int, ioprio_set, int, ioprio);
_syscall0(int, ioprio_get);

int main(int argc, char *argv[])
{
int ioprio = 2, set = 0;
int c;

while ((c = getopt(argc, argv, "+n:")) != EOF) {
switch (c) {
case 'n':
ioprio = strtol(optarg, NULL, 10);
set = 1;
break;
}
}

if (!set) {
int ioprio = ioprio_get();
if (ioprio == -1)
perror("ioprio_get");
else
printf("%d\n", ioprio_get());
} else if (argv[optind]) {
if (ioprio_set(ioprio) == -1) {
perror("ioprio_set");
return 1;
}
execvp(argv[optind], &argv[optind]);
}

return 0;
}