Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbbEIUZ0 (ORCPT ); Sat, 9 May 2015 16:25:26 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51540 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbbEIUZW (ORCPT ); Sat, 9 May 2015 16:25:22 -0400 X-Sasl-enc: hcPKM4M2hSMhyZa+Nf4tCPxqjwEiTvJwzwulpyAFvRCL 1431203121 Date: Sat, 9 May 2015 17:25:18 -0300 From: Henrique de Moraes Holschuh To: Alan Stern Cc: "Rafael J. Wysocki" , Len Brown , One Thousand Gnomes , Linux PM list , "linux-kernel@vger.kernel.org" , Len Brown Subject: Re: [PATCH 1/1] suspend: delete sys_sync() Message-ID: <20150509202518.GB20282@khazad-dum.debian.net> References: <4290667.ZqInAykFGS@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-GPG-Fingerprint1: 4096R/39CB4807 C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 X-GPG-Fingerprint2: 1024D/1CDB0FE3 5422 5C61 F6B7 06FB 7E04 3738 EE25 DE3F 1CDB 0FE3 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2012 Lines: 40 On Sat, 09 May 2015, Alan Stern wrote: > On Fri, 8 May 2015, Rafael J. Wysocki wrote: > > My current view on that is that whether or not to do a sync() before suspending > > ultimately is a policy decision and should belong to user space as such (modulo > > the autosleep situation when user space may not know when the suspend is going > > to happen). > > > > Moreover, user space is free to do as many sync()s before suspending as it > > wants to and the question here is whether or not the *kernel* should sync() > > in the suspend code path. > > > > Since we pretty much can demonstrate that having just one sync() in there is > > not sufficient in general, should we put two of them in there? Or just > > remove the existing one and leave it to user space entirely? > > I don't know about the advantages of one sync over two. But how about > adding a "syncs_before_suspend" (or just "syncs") sysfs attribute that > takes a small numeric value? The default can be 0, and the user could > set it to 1 or 2 (or higher). IMO it would be much safer to both have that knob, and to set it to keep the current behavior as the default. Userspace will adapt and change that knob to whatever is sufficient based on what it does before signaling the kernel to suspend. A regression in sync-before-suspend is sure to cause data loss episodes, after all. And, as far as bikeshedding goes, IMHO syncs_before_suspend is self-explanatory, which would be a very good reason to use it instead of the shorter requires-you-to-know-what-it-is-about "syncs". -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/