Received: by 10.213.65.68 with SMTP id h4csp693129imn; Tue, 13 Mar 2018 18:35:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELv2NT8+Nt/rH9dNiun1wB9pdNJ5PaFbvVRL6/brYg3TBwqw8jhABOKKLjPVS1P39f2ZCfkF X-Received: by 10.99.114.2 with SMTP id n2mr2194641pgc.274.1520991311087; Tue, 13 Mar 2018 18:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520991311; cv=none; d=google.com; s=arc-20160816; b=ABttYu9vtG/9TJ7G5QuyKMsCI/Poxd4dTzLfiG3xyJOvILeimbwy4Ya927EyrLiS+3 xrYaor9BimVSlhXeYXffrJSQzld4Nz3xacddcOESHltQq/P2UUdTuk/dtMw4osx6Fuxy K4+qbu1Hs9fmGRvXYp2MuIK2MXwYJd35WXfMVN+RTkVOV+efxM0DRELalNqDw5zqWtlb 1eqNPU+aSvZdBvM1TV+CwuAroxuNQ9v++rFYYNYrKbFpQIVJpbqWJ/wWgP5Q2I8jO3hC ppUYjDZ0bMC7mNURCDH1JJEDSOOSmEO18bmQPSPX4PBCyYkHUf3gdhYPxbRDJnoCAdln hTwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=B4xWAAvZ20VWKZ3ZzbmJaq8fVwnRGp4/cb/IrBH6ZKY=; b=aQ0JJp2HUC0iXUIfJD15h2sjMzSAqTYZd/yb4vbDt9KrVJ1w2K2Vo/5iF4ugIgq3MB dpnsUdwuhVfnK08mwFaEYTDpyr5mMpSbeujteXOJo0CnwHyOytJNb4iiAWBAr/pjBmUn DZi1PLPwPWiROVWf5RAvN5WgmwkMrCHFBJfawsuRNHRIVhr6gwm1uKW0XfsF6mrtenaN eRB2KJFgonHww55j4b90IGi/zwtQNNkAzVnhSzZ4ag9RGNDTSmDSyEt27EM/yVUx3xnY sLln5U3/kqYtwvGs5cfZXcHJeuATr1kHdfoYcTnz/WGkGYOJM5BpOAPs+5IpMUiRStNK VCNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CdC68qmF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si988823pgp.759.2018.03.13.18.34.56; Tue, 13 Mar 2018 18:35:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CdC68qmF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933149AbeCNBdg (ORCPT + 99 others); Tue, 13 Mar 2018 21:33:36 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:38899 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932763AbeCNBde (ORCPT ); Tue, 13 Mar 2018 21:33:34 -0400 Received: by mail-it0-f67.google.com with SMTP id j7-v6so2625904ita.3; Tue, 13 Mar 2018 18:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=B4xWAAvZ20VWKZ3ZzbmJaq8fVwnRGp4/cb/IrBH6ZKY=; b=CdC68qmFKp6ZWdE6uEwvPxfJHKXtXzbGx6DNzkXEj6ZoT4hnGt9/ZtmE/B19wMQYKf 2XkldJb73IG2LsFHRVx9byUlUdUYqA4ovtRc0r/itRkL6Rn7fmcjRCiqsMLvu8WRWD5d oEz7QxbKOfeUyZDBlOrQhlxOMIP1L4BOfXtCesxBgA9SclXKORHxPmUgybXDExyApRJL euzshcl0FTwOM2HBU2E1l9+en+WNt/7WoajR/ffB7mnHu0xsVM9N1zSs7pgHNSCr8cSo mx92zf5SCXJ+Y9tQxYmUdGU7BNUvYoDYsn1iA8gD8WXPbN4ysue2tYEbGLkD7Cv5kAdr Ifxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=B4xWAAvZ20VWKZ3ZzbmJaq8fVwnRGp4/cb/IrBH6ZKY=; b=FOdXFnX7cYuzGcV+U4s6cbEDwnpCTUjSUf1xTeIkbW2RlzblSv3zZIy6oo+Ff0SmhE LQsVN+3qpN/nLUmqVWPrnptPM2N4RpQzWJqzn/jClOrS1XsaO4ZHDnwupZfMI28VU9X5 jmHHgTJFIDxmsZhR9WKyzAY1BRDrBbbho0NLOw0VDtkXTp0Xbmj55g6Pxp0dmGKvLn6g ZhC3xbudCACVp4nllePmqEjSKedfbPsbAKnFGL4Jushtoc8EiCYd9w9L+esRIfBNxTRm NVzUiohuJRDEqNORhZkN+KdF6ecO13aI+GueiYXVdUqSWgYNVyqrZHEJYp6+04LfEcI9 Xk2w== X-Gm-Message-State: AElRT7HABrG6EVmtqHS9NgtbQwk/m+ZZFCGphuFhVw6+glrOFXDFIZP4 4+FUeKfIjiToeJ3NeMuRDYKSLQXp/0Sl2LYexuk= X-Received: by 2002:a24:bd81:: with SMTP id x123-v6mr187894ite.13.1520991213482; Tue, 13 Mar 2018 18:33:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.168.153 with HTTP; Tue, 13 Mar 2018 18:33:33 -0700 (PDT) In-Reply-To: References: <1520239666-2964-1-git-send-email-opensource.ganesh@gmail.com> From: Ganesh Mahendran Date: Wed, 14 Mar 2018 09:33:33 +0800 Message-ID: Subject: Re: [PATCH v2] PM / wakeup: use seq_open() to show wakeup stats To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Pavel Machek , "Brown, Len" , "Rafael J. Wysocki" , Greg Kroah-Hartman , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Andy 2018-03-14 0:39 GMT+08:00 Andy Shevchenko : > On Mon, Mar 5, 2018 at 10:47 AM, 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. > >> + 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