lkml.org 
[lkml]   [2018]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] PM / wakeup: use seq_open() to show wakeup stats
On Wed 2018-04-25 18:59:31, Ganesh Mahendran wrote:
> single_open() interface requires that the whole output must
> fit into a single buffer. This will lead to timeout when
> system memory is not in a good situation.
>
> This patch use seq_open() to show wakeup stats. This method
> need only one page, so timeout will not be observed.

Sounds like magic.

> -static int wakeup_sources_stats_show(struct seq_file *m, void *unused)
> +static void *wakeup_sources_stats_seq_start(struct seq_file *m,
> + loff_t *pos)
> {
...
> - srcuidx = srcu_read_lock(&wakeup_srcu);
> - list_for_each_entry_rcu(ws, &wakeup_sources, entry)
> - print_wakeup_source_stats(m, ws);
> - srcu_read_unlock(&wakeup_srcu, srcuidx);
> + *srcuidx = srcu_read_lock(&wakeup_srcu);
> + list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> + if (n-- <= 0)
> + return ws;
> + }
> +
> + return NULL;
> +}
...
> +static void wakeup_sources_stats_seq_stop(struct seq_file *m, void *v)
> +{
> + int *srcuidx = m->private;
> +
> + srcu_read_unlock(&wakeup_srcu, *srcuidx);
> +}

But you are holding srcu_lock over return to userspace, and somehow I
don't think that's permitted?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-04-29 16:31    [W:0.336 / U:10.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site