Bug 99401

Summary: /proc/timer_list prints out raw kernel jiffies
Product: Timers Reporter: William Breathitt Gray (vilhelm.gray)
Component: OtherAssignee: john stultz (john.stultz)
Status: CLOSED INVALID    
Severity: low    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.0.4 Subsystem:
Regression: No Bisected commit-id:

Description William Breathitt Gray 2015-06-03 13:55:58 UTC
I noticed that the “jiffies” line from the /proc/timer_list file has a value that is not scaled via the USER_HZ constant. Looking into the source code of the kernel/time/timer_list.c file, I found lines 189-190 to be the cause:

        SEQ_printf(m, "jiffies: %Lu\n",
                                    (unsigned long long)jiffies);

The actual kernel jiffies are printed out directly without scaling. I was under the impression that all kernel jiffies should be scaled via USER_HZ -- e.g. through the jiffies_to_clock_t function provided by include/linux/jiffies.h -- before exposure in userspace.

Is my impression correct? If not, when are kernel jiffies scaled via USER_HZ, and when are they not?
Comment 1 William Breathitt Gray 2015-08-24 23:48:27 UTC
This is not a bug; behaviour is intentional.

To quote TThomas Gleixner (http://lkml.org/lkml/2015/8/22/86):

> All instances which are de facto APIs, syscalls and also various files
> in proc/ must be in USER_HZ because userspace applications depend on
> the USER_HZ value.
> 
> proc/timer_list is exempt from that because its more a debugging
> interface which is not part of the strict kernel API. And we really
> want to see the real values and not the scaled USER_HZ ones for that
> purpose. I hope that answers your question.