[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOviyaic6iwon=OavFhR21fYA30ND7nQwAyQ9xFQ5U=0q6Rk+g@mail.gmail.com>
Date: Wed, 22 Jun 2016 02:07:09 +1000
From: Aleksa Sarai <cyphar@...har.com>
To: Kenny Yu <kennyyu@...com>
Cc: Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH v2] cgroup: Add pids controller event when fork fails
because of pid limit
> @@ -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
Powered by blists - more mailing lists