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

From: Tejun Heo
Date: Tue Jun 21 2016 - 14:23:36 EST


Hello,

On Tue, Jun 21, 2016 at 05:23:40PM +0000, Kenny Yu wrote:
> >It'd be better to use atomic64_inc_and_test() instead.
> >
> > if (err) {
> > if (atomic64_inc_and_test()) {
> > pr_xxx...;
> > }
> > cgroup_file_notify(&pids->events_file);
> > }
> >
>
> According to the docs https://www.kernel.org/doc/Documentation/atomic_ops.txt ,
> it looks like atomic_inc_and_test returns "a boolean indicating whether the resulting
> counter value was zero or not", which will only happen when the counter goes from
> negative to 0. I'll keep it as atomic_inc_return and get rid of the temp variable.

Right you're. Sorry about the confusion. Yeah, that sounds good to
me.

Thanks!

--
tejun