Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp38846imp; Wed, 20 Feb 2019 13:46:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/O/1O41+MMr6gcoUoz7b8rVyZLynTvkOw/YLOyup3kJiOrliK579FXaJGdt6dMEHaj5Ik X-Received: by 2002:a62:6e05:: with SMTP id j5mr37678293pfc.158.1550699189328; Wed, 20 Feb 2019 13:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550699189; cv=none; d=google.com; s=arc-20160816; b=y4EamNPTkgw7AybWI4MuPppAS61xx/POQV5jNsEs9FskhlWaeBeGLrECDMlsBQhT7f HImlSEYCVYqNr+QEsOs2JLCViUqZP14mzJu3pItbqQJF42zT7c14H/q+O9tZzJUxwGO9 KVR1D4Q9E3okDyaD7BIKrGVh4EgyUcqNCp2lm5fMuZt1tr+hoG2zxmtLFpNGUHrTMyGJ vVdLimGpTE2RepCRmux0fw7zJvMGh2WGcZmWdSbVBQFw1a2nTLf6ZsFjVBEpGNjYE/Bk FjkWh9DwVAt6F6Xsm3pvGwv0DtTLelnzWsuWnqv2/bG59hMMNL0nbDvczOqh3IIJluRV 7YUQ== 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 :in-reply-to:references:mime-version; bh=HtWqwxrh7CslkxN6+sxq7HIdQgCE7jo4WinV+vjvvVc=; b=elOD8bLsqREK3mRVMyquOlGqrFO5gEtnWlEsWIaqrP+TkwesQvzRvJS2yCJ1SgdNb+ FcTKToBSCr7upenzIAGqakdvrg3CfiKES8/9Y29A40D4f8lXfXfIzJit5VdPUn/ti+p5 FvabjmYOZEuCC/dDYgRPSZqKZMHrtefYk54g6QkeqJHf6czpx4WW9j0bdA5He5mp+9UA rvH4kefnpMOh8KQDdA8j1VjMniKz59VVTmYr2orW27Xsh4ZRmLMt0qeBlaWHinzdt/UJ sWuBiZ2JEavwGgWJHYdBO1JDWYp88Ezij7M3BCXnxjVHzVm27r43DwtP+smbOog12iSu zrZA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si20262320plo.377.2019.02.20.13.46.13; Wed, 20 Feb 2019 13:46:29 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727144AbfBTVph (ORCPT + 99 others); Wed, 20 Feb 2019 16:45:37 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36454 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbfBTVpg (ORCPT ); Wed, 20 Feb 2019 16:45:36 -0500 Received: by mail-ot1-f68.google.com with SMTP id v62so33985791otb.3; Wed, 20 Feb 2019 13:45:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HtWqwxrh7CslkxN6+sxq7HIdQgCE7jo4WinV+vjvvVc=; b=BLi0witLL2yCLXgRQIkue0sEzQ6Y5hgLxBikOLH8Q7+VP0atKx2XIlEaY6H7141oxW A7+dQNdSQ4ii4oV1uow0N8a0osVj1KJspPvzxWmUJozgPVupFoHezP7cmAd11wz36q63 bB5ZIWP2GVAUIqFJHnRqy+OluO7if7JpCLgi52Sgkut1Jvnive6pVrd1+OiK2evMaRvx NmYxJpjJE7O3KS1YOvfxjUONUuZdqHTEXwuiR7EqWrcsZkY4g17Pyg2sZ+okmuJ4yRMR D3TSAOoIinbPNxC5Rn8j4djH3XN9+k3RB7XIp/UNE+0/nA9JTjRVgiRNX2tdeZthhdmb ypZw== X-Gm-Message-State: AHQUAuZMCsmC3teuqNgTEQD8QV5p4UR4gQoakHBxQSfQFrhu3GN89ZGB uVgzi2eTl39jncVp7M3kbBFEDn24PXybzQLYdrQ= X-Received: by 2002:a9d:7547:: with SMTP id b7mr6352238otl.244.1550699135895; Wed, 20 Feb 2019 13:45:35 -0800 (PST) MIME-Version: 1.0 References: <20190206154214.576-1-harry.pan@intel.com> <20190214111543.22137-1-harry.pan@intel.com> <2819109.DzhZvocLkm@aspire.rjw.lan> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 20 Feb 2019 22:45:24 +0100 Message-ID: Subject: Re: [PATCH v3] PM / suspend: measure the time of filesystem syncing To: "Pan, Harry" Cc: "rjw@rjwysocki.net" , "Brown, Len" , "linux-kernel@vger.kernel.org" , "gs0622@gmail.com" , "pavel@ucw.cz" , "linux-pm@vger.kernel.org" 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 Wed, Feb 20, 2019 at 5:44 PM Pan, Harry wrote: > > Thanks for comments. > > > > + if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC)) { > > > + ktime_t start; > > > + unsigned int elapsed_msecs; > > > + > > > + trace_suspend_resume(TPS("sync_filesystems"), 0, true); > > > + pr_info("Syncing filesystems ... "); > > > + start = ktime_get(); > > > + ksys_sync(); > > > + elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), > > > start)); > > > + pr_cont("(elapsed %d.%03d seconds) done.\n", > > > + elapsed_msecs / MSEC_PER_SEC, > > > + elapsed_msecs % MSEC_PER_SEC); > > > > One more nit. > > > > Since you are printing the sync time anyway, there is a little sense > > to > > split the message using pr_cont() that may be messed up with by any > > intervening messages, so why don't you just print a one-line > > pr_info("Filesystems sync: %d.%03d seconds\n", ...) message? > > > Yes, I agree. > In practical, I did see intervening messages (between pr_info and > pr_cont) when it came to long sync in kernel. > I was hesitated in this considering not fully understanding the > backdrop of split messages using pr_info() then pr_cont(). > > > Also, if you change it here, I guess it would be consistent to make > > an analogous change for hibernation. > > One potential last-mile need your wisdom, which is about the switch > case of SNAPSHOT_FREEZE of the userspace interface you wrote. > I am yet to touch it, nor understand how to validate it. Why don't you add a "sync" helper function in main.c with the timing and message that will be called from hibernate.c, user.c and suspend.c (in the last one conditional on !IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC))? That would reduce some code duplication nicely.