[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201005270034.44492.rjw@sisk.pl>
Date: Thu, 27 May 2010 00:34:44 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Peter Zijlstra <peterz@...radead.org>,
Cornelia Huck <cornelia.huck@...ibm.com>,
Len Brown <len.brown@...el.com>,
Jim Collar <jim.collar@...are.net>, linux-doc@...r.kernel.org,
"Greg Kroah-Hartman" <gregkh@...e.de>,
linux-kernel@...r.kernel.org, Avi Kivity <avi@...hat.com>,
Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>,
Magnus Damm <damm@...l.co.jp>,
linux-pm@...ts.linux-foundation.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [linux-pm] [PATCH 2/8] PM: suspend_block: Add driver to access suspend blockers from user-space
On Thursday 27 May 2010, Alan Stern wrote:
> On Wed, 26 May 2010, Rafael J. Wysocki wrote:
>
> > On Wednesday 26 May 2010, Peter Zijlstra wrote:
> > > On Fri, 2010-05-21 at 15:46 -0700, Arve Hjønnevåg wrote:
> > > > +To create a suspend blocker from user space, open the suspend_blocker
> > > > special
> > > > +device file:
> > > > +
> > > > + fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC);
> > > > +
> > > > +then optionally call:
> > > > +
> > > > + ioctl(fd, SUSPEND_BLOCKER_IOCTL_SET_NAME(strlen(name)), name);
> > > > +
> > > > +To activate the suspend blocker call:
> > > > +
> > > > + ioctl(fd, SUSPEND_BLOCKER_IOCTL_BLOCK);
> > > > +
> > > > +To deactivate it call:
> > > > +
> > > > + ioctl(fd, SUSPEND_BLOCKER_IOCTL_UNBLOCK);
> > > > +
> > > > +To destroy the suspend blocker, close the device:
> > > > +
> > > > + close(fd);
> > >
> > > Urgh, please let the open() be BLOCK, the close() be UNBLOCK, and keep
> > > the SET_NAME thing if you really care.
> >
> > SET_NAME wouldn't serve any purpose in that case.
> >
> > This whole thing is related to the statistics part, which Arve says is
> > essential to him. He wants to collect statistics for each suspend blocker
> > activated and deactivated so that he can tell who's causing problems by
> > blocking suspend too often. The name also is a part of this.
> >
> > In fact, without the statistics part the whole thing might be implemented
> > as a single reference counter such that suspend would happen when it went down
> > to zero.
>
> There's also Arve's other main point: These suspend blockers tend to
> get used quite a lot. Opening and closing a file each time has much
> higher overhead than a simple ioctl.
>
> All these topics have been covered earlier in this discussion. Peter
> should go back and read the emails in the linux-pm archive.
Yeah.
Although with a reference counter the special device file won't be necessary.
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists