[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADAEsF__v8b01DAC9d8B93oJk3GiqEyfieSgM6kj9CfetXMqaQ@mail.gmail.com>
Date: Wed, 14 Mar 2018 09:33:33 +0800
From: Ganesh Mahendran <opensource.ganesh@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Pavel Machek <pavel@....cz>,
"Brown, Len" <len.brown@...el.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] PM / wakeup: use seq_open() to show wakeup stats
Hi, Andy
2018-03-14 0:39 GMT+08:00 Andy Shevchenko <andy.shevchenko@...il.com>:
> On Mon, Mar 5, 2018 at 10:47 AM, Ganesh Mahendran
> <opensource.ganesh@...il.com> 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.
>
>> + if (n == 0) {
>> + seq_puts(m, "name\t\tactive_count\tevent_count\twakeup_count\t"
>> + "expire_count\tactive_since\ttotal_time\tmax_time\t"
>> + "last_change\tprevent_suspend_time\n");
>> + }
>
> Can't you do this once at ->open() stage, for example?
We can not put this at ->open(). Because in seq_open(), the buffer is
not ready,
the seq buffer is allocated in seq_read().
Thanks.
>
>> static int wakeup_sources_stats_open(struct inode *inode, struct file *file)
>> {
>> - return single_open(file, wakeup_sources_stats_show, NULL);
>> + return seq_open_private(file, &wakeup_sources_stats_seq_ops, sizeof(int));
>> }
>
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists