[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT_GOooEqFpGMRA=k7eLUzBG3YqqUqjogUnHbS3J=mYU-w@mail.gmail.com>
Date: Tue, 14 Jun 2016 12:14:51 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Topi Miettinen <toiwoton@...il.com>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Al Viro <viro@...iv.linux.org.uk>,
John Stultz <john.stultz@...aro.org>,
Janis Danisevskis <jdanis@...gle.com>,
Calvin Owens <calvinowens@...com>, Jann Horn <jann@...jh.net>
Subject: Re: [RFC 06/18] limits: present RLIMIT_CPU and RLIMIT_RTTIMER current status
On Mon, Jun 13, 2016 at 10:44 PM, Topi Miettinen <toiwoton@...il.com> wrote:
> Present current cputimer status in /proc/self/limits.
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -650,8 +650,30 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
> + switch (i) {
> + case RLIMIT_RTTIME:
> + case RLIMIT_CPU:
> + if (rlim[i].rlim_max == RLIM_INFINITY)
> + seq_printf(m, "%-20s\n", "-");
> + else {
> + unsigned long long utime, ptime;
> + unsigned long psecs;
> + struct task_cputime cputime;
> +
> + thread_group_cputimer(task, &cputime);
> + utime = cputime_to_expires(cputime.utime);
> + ptime = utime + cputime_to_expires(cputime.stime);
> + psecs = cputime_to_secs(ptime);
> + if (i == RLIMIT_RTTIME)
> + psecs *= USEC_PER_SEC;
> + seq_printf(m, "%-20lu\n", psecs);
> + }
> + break;
Let's keep rlimits file for rlimits.
Powered by blists - more mailing lists