#include #include #include #include static int i; static struct delayed_work d_work; static void schedtest_work(struct work_struct *work) { schedule_delayed_work(&d_work, msecs_to_jiffies(1)); if (i++ % 500 == 0) { printk(KERN_DEBUG "schedtest: I am on CPU %d.\n", get_cpu()); put_cpu(); } } static int __init schedtest_init_module(void) { INIT_DELAYED_WORK(&d_work, schedtest_work); schedule_delayed_work(&d_work, 0); return 0; } static void __exit schedtest_cleanup_module(void) { cancel_delayed_work_sync(&d_work); } module_init(schedtest_init_module); module_exit(schedtest_cleanup_module); MODULE_LICENSE("GPL");