On Tue, 26 Mar 2013 19:56:30 -0500 Nathan Zimmer <[email protected]> wrote:

> When running with 4096 cores attemping to read /proc/timer_list will fail
> with an ENOMEM condition.  On a sufficantly large systems the total amount
> of data is more then 4mb, so it won't fit into a single buffer.  The
> failure can also occur on smaller systems when memory fragmentation is
> high as reported by Dave Jones.
> 
> Convert /proc/timer_list to a proper seq_file with its own iterator.  This
> is a little more complex given that we have to make two passes with two
> separate headers.
> 
> sysrq_timer_list_show also needed to be updated to reflect the fact that
> now timer_list_show only does one cpu at at time.
> 
> ...
>
> --- a/kernel/time/timer_list.c
> +++ b/kernel/time/timer_list.c
> @@ -20,6 +20,13 @@
>  
>  #include <asm/uaccess.h>
>  
> +
> +struct timer_list_iter {
> +     int cpu;
> +     bool second_pass;
> +     u64 now;
> +};
> +
>  typedef void (*print_fn_t)(struct seq_file *m, unsigned int *classes);
>  
>  DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
> @@ -247,43 +254,101 @@ static void timer_list_show_tickdevices_header(struct 
> seq_file *m)
>  }
>  #endif
>  
> -static int timer_list_show(struct seq_file *m, void *v)
> +static inline void timer_list_header(struct seq_file *m, u64 now)

There's really no point in the explicit inline directive - modern gcc's
basically ignore it anyway.

>  {
> -     u64 now = ktime_to_ns(ktime_get());
> -     int cpu;
> -
>       SEQ_printf(m, "Timer List Version: v0.7\n");
>       SEQ_printf(m, "HRTIMER_MAX_CLOCK_BASES: %d\n", HRTIMER_MAX_CLOCK_BASES);
>       SEQ_printf(m, "now at %Ld nsecs\n", (unsigned long long)now);
>       SEQ_printf(m, "\n");
> +}
>
> ...
>
> +void sysrq_timer_list_show(void)
> +{
> +     u64 now = ktime_to_ns(ktime_get());
> +     int cpu;
> +
> +     timer_list_header(NULL, now);
>  
>       for_each_online_cpu(cpu)

hm, it seems this code is taking the optimistic approach to CPU hotplug.

> -             print_cpu(m, cpu, now);
> +             print_cpu(NULL, cpu, now);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to