From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751329AbbCIDjx (ORCPT ); Sun, 8 Mar 2015 23:39:53 -0400 Received: from mail-qc0-f179.google.com ([209.85.216.179]:43134 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750892AbbCIDjv (ORCPT ); Sun, 8 Mar 2015 23:39:51 -0400 Date: Sun, 8 Mar 2015 23:39:46 -0400 From: Tejun Heo To: Aleksa Sarai Cc: lizefan@huawei.com, mingo@redhat.com, peterz@infradead.org, richard@nod.at, fweisbec@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v4 2/2] cgroups: add a pids subsystem Message-ID: <20150309033946.GG13283@htj.duckdns.org> References: <1424660891-12719-1-git-send-email-cyphar@cyphar.com> <1425606357-6337-1-git-send-email-cyphar@cyphar.com> <1425606357-6337-3-git-send-email-cyphar@cyphar.com> <20150309033405.GE13283@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150309033405.GE13283@htj.duckdns.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 08, 2015 at 11:34:05PM -0400, Tejun Heo wrote: > > + for (p = pids; p; p = p->parent) { > > + long new; > > + > > + new = atomic_long_add_return(num, &p->counter); > > + > > + if (p->limit == PIDS_UNLIMITED) > > + continue; > > Huh? So, the counter stays out of sync if unlimited? What happens > when it gets set to something else later? Oops, I misread the code, but why is PIDS_UNLIMITED a special case? Just make it a number which always makes the condition true? Thanks. -- tejun From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH v4 2/2] cgroups: add a pids subsystem Date: Sun, 8 Mar 2015 23:39:46 -0400 Message-ID: <20150309033946.GG13283@htj.duckdns.org> References: <1424660891-12719-1-git-send-email-cyphar@cyphar.com> <1425606357-6337-1-git-send-email-cyphar@cyphar.com> <1425606357-6337-3-git-send-email-cyphar@cyphar.com> <20150309033405.GE13283@htj.duckdns.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=91xeZh9wV0+cxXuD38EyazXTzxNLmJpOrp93BD4dQCo=; b=H+7F7DDL8E2J4gnlb1/l4dDpRFXPfcfhOUqo0Euhqq55BwjgKgdqAb7frlgBIBjo2m jovDLrYBXGiDm2BTZzMa1a+mlPxvx48sC8KevG6W8cK3tKcEuZwt0870RmXgAba2F4vI S645ygfZ1STQ+iQjb/Ixffob+Us9tO9x+QNKXg5KzHoi92HbEfcpdYd0AAw3ksZGyhzB RvDtkn+HJKWGqCWGhxTOPSsiiDhz2GMSVknru8f07D6MzoY2J7qRaCifR0vyIjLFD0vc 3/LL2T+1TMQt4jxa/X871Yntqmq3ATais75lK6iXmomHXXjzTwr+GY/wAoHnVzXcy+c0 4GCQ== Content-Disposition: inline In-Reply-To: <20150309033405.GE13283-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Aleksa Sarai Cc: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, richard-/L3Ra7n9ekc@public.gmane.org, fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Sun, Mar 08, 2015 at 11:34:05PM -0400, Tejun Heo wrote: > > + for (p = pids; p; p = p->parent) { > > + long new; > > + > > + new = atomic_long_add_return(num, &p->counter); > > + > > + if (p->limit == PIDS_UNLIMITED) > > + continue; > > Huh? So, the counter stays out of sync if unlimited? What happens > when it gets set to something else later? Oops, I misread the code, but why is PIDS_UNLIMITED a special case? Just make it a number which always makes the condition true? Thanks. -- tejun