From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbcFNJO5 (ORCPT ); Tue, 14 Jun 2016 05:14:57 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34238 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279AbcFNJOx (ORCPT ); Tue, 14 Jun 2016 05:14:53 -0400 MIME-Version: 1.0 In-Reply-To: <1465847065-3577-7-git-send-email-toiwoton@gmail.com> References: <1465847065-3577-1-git-send-email-toiwoton@gmail.com> <1465847065-3577-7-git-send-email-toiwoton@gmail.com> From: Alexey Dobriyan Date: Tue, 14 Jun 2016 12:14:51 +0300 Message-ID: Subject: Re: [RFC 06/18] limits: present RLIMIT_CPU and RLIMIT_RTTIMER current status To: Topi Miettinen Cc: Linux Kernel , Andrew Morton , Kees Cook , Al Viro , John Stultz , Janis Danisevskis , Calvin Owens , Jann Horn Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 13, 2016 at 10:44 PM, Topi Miettinen 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.