Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335976

[PATCH 0/2] Extend timer_slack_ns to u64 on 32bit systems & add /proc/<pid>/timerslack_ns

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 0/2] Extend timer_slack_ns to u64 on 32bit systems & add /proc/<pid>/timerslack_ns
Date 2016-02-17 02:10 +0100
Message-ID <r2YMV-7mJ-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


I didn't get any negative feedback on the last round of this,
so I figured I'd send it along w/o the RFC header this time.

This patchset introduces a /proc/<pid>/timerslack_ns interface
which would allow controlling processes to be able to set the
timerslack value on other processes in order to save power by
avoiding wakeups (Something Android currently does via
out-of-tree patches).

The first patch tries to fix the internal timer_slack_ns usage
which was defined as a long, which limits the slack range to
~4 seconds on 32bit systems. It converts it to a u64, which
provides the same basically unlimited slack (500 years) on both
32bit and 64bit machines.

The second patch introduces the /proc/<pid>/timerslack_ns
interface which allows the full 64bit slack range for a task
to be read or set on both 32bit and 64bit machines.

With these two patches, on a 32bit machine, after setting the
slack on bash to 10 seconds:
$ time sleep 1

real    0m10.747s
user    0m0.001s
sys     0m0.005s


The first patch is a little ugly, since I had to chase the slack
delta arguments through a number of functions converting them to
u64s. Let me know if it makes sense to break that up more or not.

Other then that things are fairly straight forward.

Feedback and thoughts would be greatly appreciated!

thanks
-john

Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oren Laadan <orenl@cellrox.com>
Cc: Ruchi Kandoi <kandoiruchi@google.com>
Cc: Rom Lemarchand <romlem@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Android Kernel Team <kernel-team@android.com>

John Stultz (2):
  timer: Convert timer_slack_ns from unsigned long to u64
  proc: Add /proc/<pid>/timerslack_ns interface

 Documentation/filesystems/proc.txt | 18 ++++++++++
 fs/eventpoll.c                     |  2 +-
 fs/proc/base.c                     | 69 ++++++++++++++++++++++++++++++++++++++
 fs/select.c                        |  8 ++---
 include/linux/freezer.h            |  2 +-
 include/linux/hrtimer.h            | 12 ++++---
 include/linux/poll.h               |  2 +-
 include/linux/sched.h              |  4 +--
 kernel/sys.c                       |  5 ++-
 kernel/time/hrtimer.c              |  8 ++---
 kernel/time/timer.c                |  4 +--
 11 files changed, 113 insertions(+), 21 deletions(-)

-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] Extend timer_slack_ns to u64 on 32bit systems & add /proc/<pid>/timerslack_ns John Stultz <john.stultz@linaro.org> - 2016-02-17 02:10 +0100
  [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 02:10 +0100
    Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 20:40 +0100
      Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Kees Cook <keescook@chromium.org> - 2016-02-17 21:10 +0100
        Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 21:20 +0100
          Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 22:00 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 22:10 +0100
          Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 23:30 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 23:50 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Kees Cook <keescook@chromium.org> - 2016-02-17 23:50 +0100
              Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-18 00:00 +0100
      Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 21:50 +0100
    [PATCH] proc: /proc/<pid>/timerslack_ns permissions fixes John Stultz <john.stultz@linaro.org> - 2016-02-18 07:00 +0100
      Re: [PATCH] proc: /proc/<pid>/timerslack_ns permissions fixes Kees Cook <keescook@chromium.org> - 2016-02-18 19:00 +0100

csiph-web