Le 09-04-2006, Bernhard Walle <bernhard.walle@xxxxxx> a écrit : > Hello, > > I'm experimenting about kernel preemption. If I understand it > correctly, a process executing a syscall could be preempted by another > process with a higher priority. > > I have a simple kernel module with a 10 seconds loop in the > init_module() function. This function should be preemptible because > it's the insmod process in the init_module system call. > > But another process with SCHED_FIFO (prio 99) isn't run until the init > function exits. > > The code is > > int __init preempt_test_init(void) > { > unsigned long end; > > end = jiffies + HZ * 10; /* 10 seconds */ > > pr_info("Preempt_count = %d\n", preempt_count()); > while (time_before(jiffies, end)); > pr_info("End\n"); > } > > and of the process > > memset(&parm, 0, sizeof (struct sched_param)); > parm.sched_priority = 99; > > err = sched_setscheduler(getpid(), SCHED_FIFO, &parm); > if (err < 0) { > perror("Cannot change scheduler"); > return 1; > } > > while (true) { > printf("Scheduled, count = %d\n", counter++); > sleep(1); > } > > Thanks! In a personal email, you told me that you use VmWare to test this code. You should test it without VmWare. I don't how the emulator works but there must be some problems and process confusions. Is each process a real unix process ... ? Well try this code on a real linux environnement. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/