lkml.org 
[lkml]   [2017]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectschedule_delayed_work off by one jiffy
Date
Hi,

We are using Kernel 4.10.0-19-generic. In one of our test drivers, we assign a task to the global work queue, using schedule_delayed_work().

The issue we observe, is that when we call schedule_delayed_work(task, n) with delay of "n" jiffies, the task is getting scheduled after a delay of "n+1" and not "n" jiffies as expected.

This worked fine till the kernel version 4.4.0-87-generic. The observation is on kernel 4.10.0-19-generic and above.

A sample test code to highlight the difference between the kernel is given below:

static struct tq_struct g_Task = { routine:interrupt_handler, data:NULL };

static void interrupt_handler( struct work_struct *irrelevant ) {
printk("check 1 Jiffies: %llu \n", get_jiffies_64());
schedule_delayed_work( &g_Task, 1);
printk("Check 2 Jiffies: %llu \n", get_jiffies_64());
}

The dmesg output on 4.10 is as below (diff of 2 jiffies)
[ 1047.975259] check 1 Jiffies: 4295153276
[ 1047.975263] Check 2 Jiffies: 4295153276
[ 1047.983255] check 1 Jiffies: 4295153278
[ 1047.983259] Check 2 Jiffies: 4295153278
[ 1047.991255] check 1 Jiffies: 4295153280
[ 1047.991260] Check 2 Jiffies: 4295153280

The dmesg output on 4.4 is as below (diff of 1 jiffies)
[ 830.490657] check 1 Jiffies: 4295098955
[ 830.490664] Check 2 Jiffies: 4295098955
[ 830.494657] check 1 Jiffies: 4295098956
[ 830.494667] Check 2 Jiffies: 4295098956
[ 830.498656] check 1 Jiffies: 4295098957
[ 830.498663] Check 2 Jiffies: 4295098957

Thanks,
Rajendra

\
 
 \ /
  Last update: 2017-11-17 17:19    [W:0.023 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site