Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-10 Thread Lennart Poettering
On Thu, 03.04.14 15:42, Cristian Rodríguez (crrodrig...@opensuse.org) wrote:

 While it is cool to be neat and clean all the time, this
 task can wait if we are on battery.
 ---
  units/systemd-tmpfiles-clean.service.in | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/units/systemd-tmpfiles-clean.service.in 
 b/units/systemd-tmpfiles-clean.service.in
 index a5b5acb..06bb21f 100644
 --- a/units/systemd-tmpfiles-clean.service.in
 +++ b/units/systemd-tmpfiles-clean.service.in
 @@ -16,6 +16,7 @@ ConditionDirectoryNotEmpty=|/usr/lib/tmpfiles.d
  ConditionDirectoryNotEmpty=|/usr/local/lib/tmpfiles.d
  ConditionDirectoryNotEmpty=|/etc/tmpfiles.d
  ConditionDirectoryNotEmpty=|/run/tmpfiles.d
 +ConditionACPower=true

This has come up before, but I don't think this is the right thing to
do. It might make sense to modulate the timer frequency depending on
power state, but I am pretty sure we shouldn't just stop cleaning up
things if people never plug in their machine while it is unsuspended...

Modulating the timer frequency would mean to track power state for all
connected power sources from PID1. Which might be OK to do, but isn't
trivial.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-06 Thread Kai Krakow
Tomasz Torcz to...@pipebreaker.pl schrieb:

 On Thu, Apr 03, 2014 at 03:42:08PM -0300, Cristian Rodríguez wrote:
 While it is cool to be neat and clean all the time, this
 task can wait if we are on battery.
 
   What if I connect my laptop to AC only when it sleeps? This will
 never run.  I also don't think couple stats() and rm's have any
 measurable impact on battery.

Additionally, it may be counter-productive because /tmp is usually mounted 
as tmpfs, thus tmp files occupy RAM, and cleaning RAM usually optimizes for 
battery lifetime because it reduces the need for swapping.

I think the original intention behind this is not to wake up spinning disks 
- but it is almost impossible to ensure that anyway because standard 
flushing behavior of unix fs simply does not support this. For anyone 
wanting to optimize for that, they are smart enough to also optimize systemd 
for it.

-- 
Replies to list only preferred.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-03 Thread Tomasz Torcz
On Thu, Apr 03, 2014 at 03:42:08PM -0300, Cristian Rodríguez wrote:
 While it is cool to be neat and clean all the time, this
 task can wait if we are on battery.

  What if I connect my laptop to AC only when it sleeps? This will
never run.  I also don't think couple stats() and rm's have any
measurable impact on battery.


-- 
Tomasz TorczOnly gods can safely risk perfection,
xmpp: zdzich...@chrome.pl it's a dangerous thing for a man.  -- Alia

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-03 Thread Leonid Isaev
On Thu, 3 Apr 2014 21:26:23 +0200
Tomasz Torcz to...@pipebreaker.pl wrote:

 On Thu, Apr 03, 2014 at 03:42:08PM -0300, Cristian Rodríguez wrote:
  While it is cool to be neat and clean all the time, this
  task can wait if we are on battery.
 
   What if I connect my laptop to AC only when it sleeps? This will
 never run. 

I agree that cleaning /tmp and /run is a low-priority task, but what if there
are custom *.conf files in /etc/tmpfiles.d? AFAIU, these will not be run as
well, but may be needed.

And in the past, the difference in AC-powered and BAT-powered behavior in
pm-utils and Upower has created _lots_ of confusion.

 I also don't think couple stats() and rm's have any
 measurable impact on battery.
 

Stock tmpfiles.d clean routine applies only to tmpfs (by default) filesystems.
On a battery-powered system, they are most likely clean due to small uptime.

-- 
Leonid Isaev
GnuPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE  775A A7AE F6CB 164B 5A6D


signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-03 Thread Kirill Elagin
On Thu, Apr 3, 2014 at 11:51 PM, Leonid Isaev lis...@umail.iu.edu wrote:

 On a battery-powered system, they are most likely clean due to small
 uptime.


I can't agree.
Nowadays battery-powered systems tend to have huge uptimes
due to being mostly suspended and rarely powered-off/rebooted.

Anyway, I think Tomasz is right, impact here is hardly measurable, and
those, who
worry about those three rm's are free to override the unit file.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] run systemd-tmpfiles-clean only when we have AC power

2014-04-03 Thread David Timothy Strauss
-1 on adding ConditionACPower=true

I frequently only plug in my laptop after putting it to sleep and then
disconnect it before waking it up again. It'd be possible to run
cleanup less frequently when on battery, but that would just delay the
work and increase the impact (which is pretty negligible right now)
when it happens.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel