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


Groups > linux.kernel > #1427908

Re: [PATCH v2] cgroup: Add pids controller event when fork fails because of pid limit

From Aleksa Sarai <cyphar@cyphar.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] cgroup: Add pids controller event when fork fails because of pid limit
Date 2016-06-21 18:10 +0200
Message-ID <rMwpr-853-3@gated-at.bofh.it> (permalink)
References <rMlNn-12h-1@gated-at.bofh.it> <rMwpr-853-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> @@ -213,10 +227,21 @@ static int pids_can_fork(struct task_struct *task)
>  {
>         struct cgroup_subsys_state *css;
>         struct pids_cgroup *pids;
> +       int err;
>
>         css = task_css_check(current, pids_cgrp_id, true);
>         pids = css_pids(css);
> -       return pids_try_charge(pids, 1);
> +       err = pids_try_charge(pids, 1);
> +       if (err) {
> +               atomic64_inc(&pids->events_limit);
> +               cgroup_file_notify(&pids->events_file);
> +               if (!atomic_xchg(&pids->events_limit_logged, 1)) {
> +                       pr_info("cgroup: fork rejected by pids controller in ");
> +                       pr_cont_cgroup_path(task_cgroup(current, pids_cgrp_id));
> +                       pr_cont("\n");
> +               }
> +       }
> +       return err;
>  }

Why are we logging this? Isn't the pids.events file enough
information? I feel like you could remove a lot of logic if you don't
log this.

And even if we do end up logging it, why have the boolean flag (the
counter always increases, just log if the counter is currently 0 and
you're incrementing it).

-- 
Aleksa Sarai (cyphar)
www.cyphar.com

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


Thread

[PATCH] cgroup: Add pids controller event when fork fails because of pid limit Kenny Yu <kennyyu@fb.com> - 2016-06-21 05:20 +0200
  Re: [PATCH] cgroup: Add pids controller event when fork fails  because of pid limit Johannes Weiner <hannes@cmpxchg.org> - 2016-06-21 06:50 +0200
    Re: [PATCH v2] cgroup: Add pids controller event when fork fails  because of pid limit Aleksa Sarai <cyphar@cyphar.com> - 2016-06-21 18:10 +0200
      Re: [PATCH v2] cgroup: Add pids controller event when fork fails  because of pid limit Tejun Heo <tj@kernel.org> - 2016-06-21 18:40 +0200
        [PATCH v3] cgroup: Add pids controller event when fork fails because of pid limit Kenny Yu <kennyyu@fb.com> - 2016-06-21 19:00 +0200
          Re: [PATCH v3] cgroup: Add pids controller event when fork fails  because of pid limit Tejun Heo <tj@kernel.org> - 2016-06-21 19:20 +0200
            Re: [PATCH v3] cgroup: Add pids controller event when fork fails  because of pid limit Tejun Heo <tj@kernel.org> - 2016-06-21 20:30 +0200
              [PATCH v4] cgroup: Add pids controller event when fork fails because of pid limit Kenny Yu <kennyyu@fb.com> - 2016-06-21 20:40 +0200
            Re: [PATCH v3] cgroup: Add pids controller event when fork fails  because of pid limit Kenny Yu <kennyyu@fb.com> - 2016-06-21 20:40 +0200
    [PATCH v2] cgroup: Add pids controller event when fork fails because of pid limit Kenny Yu <kennyyu@fb.com> - 2016-06-21 18:30 +0200

csiph-web