Received: by 10.213.65.68 with SMTP id h4csp458125imn; Tue, 13 Mar 2018 09:41:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELsct0Dljrgz6pNAzeRWjYAm6G5wrJ/34JG18B5t3Ntml5Up8gvwctRL7EAS8S20K1Gal7+g X-Received: by 10.99.111.2 with SMTP id k2mr949394pgc.199.1520959286045; Tue, 13 Mar 2018 09:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520959286; cv=none; d=google.com; s=arc-20160816; b=sh4h+SnhCQ1wJl3cl2hlNEj311Mmzxo2eyIxWDBgvM0fVdz3gVe7zUShlLQUYKEh6X 3pOkMdINh8emHHYUW6Wd76GalgxpT89itBNTCzqmkxp2kOdu6wsFTOWx0cxtUE99M/zX W8gUFtV4Z4diQTYbmWFk8LpWUjboYRUESfVAS8MxIiinatEdoKmEuyrupu85Dklc63yf c6PubxWlXYJidsdXa1SEfrm6Ejjd3/ugUQVu851ASpKtFm5kfhx/+y+ufhgNURUBkUBm TpFPOo6c/whveyJfpgRrWd5mS/sNKmp8lof5uBp16tbOCnzKu2/+j6aPuHswD11rkn9G LWMA== 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=achoZEZ1KvVp+nKjWNHUrfgF8IHVoA1V+jQch3tOHE0=; b=rophw5cLyU9XL+cooExK4fM7eWyk4cv11p+7FRu1Avr4g477rTALLEs7Vhnv61JT0U sZzZ1WBbQKjN72jMC5vN7OmyEJUyKWffcwDLGgqFgRB+5Oxm38G3hdq1EGXx1FwnSgtt 4qQCgx+sFZ7dhOtaolz8vMewOZSlirjzCShkZWJSlHjA8c9bGj0i5cCKfzMNmBDb791L 9gB5B1e/zM3egPPNtzI/ovcO6W1c5T2Tj6XswQShmBoSoVny0U4PQXFnMHNowSnYAC6M 5eqbwZrK8t2xCD8+HSnpFdtKCqwSM/MfAJBu3nnSi0PkNhn7rrhDoY6N+Zq42vd8pevk KPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TKSOSOAX; 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 w17-v6si340872plp.561.2018.03.13.09.41.10; Tue, 13 Mar 2018 09:41:25 -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=TKSOSOAX; 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 S1753019AbeCMQjw (ORCPT + 99 others); Tue, 13 Mar 2018 12:39:52 -0400 Received: from mail-qt0-f173.google.com ([209.85.216.173]:37478 "EHLO mail-qt0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752969AbeCMQjt (ORCPT ); Tue, 13 Mar 2018 12:39:49 -0400 Received: by mail-qt0-f173.google.com with SMTP id a23so272991qtm.4; Tue, 13 Mar 2018 09:39:48 -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=achoZEZ1KvVp+nKjWNHUrfgF8IHVoA1V+jQch3tOHE0=; b=TKSOSOAXrn8J8rJBD4kWbpqL+vi0g8uhrqb3cidBXH9/7Y7sdqoGsshtR+CrCffLUV KeegbWtWhUphdJC03m5OL0Rea1oAIW3dNhDWwYsWoCHkEy+5Kts1cn3uf8qjpGrQnAsX SVgVe6Vych/uFjS7ejPOrl4unMb5aDDoS3xX0bUehU0feMT4GAnLmOaA16dNDaTJO9PC 7ytC1bHGZ8fO8i0pqBjr6WPMoj4IXkH07JqsQnEwgV2jAhe2zpkHqaM5MhLJifwje0vE +N4k7ahVE7b+J7xIIFWNbBhjaHoQEXRoa8DR9FwNObmYpnOwpitGvxgRncPZVb+Apat0 eXUA== 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=achoZEZ1KvVp+nKjWNHUrfgF8IHVoA1V+jQch3tOHE0=; b=ARfc3LmJXDHGJYEsqgJC5c8bj3ry5xZGR7z7qeNp6wxRxbk8uNDqqBjrojWh8MMQ0V Hg+LetF4tW2gCMjZ7JNHlu6oa5G2uHntdSz1wLfOJBrLNYNIxyPMjy3d8Ud/lZVcrgB+ lnKlKe6zxqmg246dM3JBQJKZ6pQzicUssjcOTFIKt/wJsBu+x8d2UG4LCHWcq1Qxgt9r +y6Do6JmQL9rgqTMR4rZCavrxyISEwU0+K4m28mWLylyEQ3qhJ3rnls9Rl/wdJ8IvRsO F8ujfFnxmhcs2lSn4bPrH0e1LSzPZr4OCvQWT9teWbp9zkqxC+J/qZ3Cb5EPJPPwwy4M o0aw== X-Gm-Message-State: AElRT7G9TpLDv5QV24PyU5AZUuEOvoh1Te5qnkxyRAG4OIQ//nsLQhaR CQK+S+jvFzBtqV7XeCoQA/vUg24q0A7s8Wj7yUI= X-Received: by 10.200.39.217 with SMTP id x25mr1994126qtx.266.1520959188216; Tue, 13 Mar 2018 09:39:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Tue, 13 Mar 2018 09:39:47 -0700 (PDT) In-Reply-To: <1520239666-2964-1-git-send-email-opensource.ganesh@gmail.com> References: <1520239666-2964-1-git-send-email-opensource.ganesh@gmail.com> From: Andy Shevchenko Date: Tue, 13 Mar 2018 18:39:47 +0200 Message-ID: Subject: Re: [PATCH v2] PM / wakeup: use seq_open() to show wakeup stats To: Ganesh Mahendran 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 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? > 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