Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932179AbbEKUef (ORCPT ); Mon, 11 May 2015 16:34:35 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34653 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752434AbbEKUee (ORCPT ); Mon, 11 May 2015 16:34:34 -0400 MIME-Version: 1.0 In-Reply-To: <20150509202518.GB20282@khazad-dum.debian.net> References: <4290667.ZqInAykFGS@vostro.rjw.lan> <20150509202518.GB20282@khazad-dum.debian.net> Date: Mon, 11 May 2015 16:34:32 -0400 X-Google-Sender-Auth: pbT4XDShuF4PmDFirN8X5JAnv48 Message-ID: Subject: Re: [PATCH 1/1] suspend: delete sys_sync() From: Len Brown To: Henrique de Moraes Holschuh Cc: Alan Stern , "Rafael J. Wysocki" , One Thousand Gnomes , Linux PM list , "linux-kernel@vger.kernel.org" , Len Brown Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2358 Lines: 50 On Sat, May 9, 2015 at 4:25 PM, Henrique de Moraes Holschuh wrote: > 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". > When I first thought about this, I had a similar view: https://lkml.org/lkml/2014/1/23/45 But upon reflection, I do not believe that the kernel is adding value here, instead it is imposing a policy, and that policy decision is sometimes prohibitively expensive. User-space can do this for itself (and in the case of desktop distros, already does), and so the kernel should butt-out. thanks, Len Brown, Intel Open Source Technology Center -- 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/