From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbcFUS5p (ORCPT ); Tue, 21 Jun 2016 14:57:45 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:34808 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907AbcFUS5n (ORCPT ); Tue, 21 Jun 2016 14:57:43 -0400 Date: Tue, 21 Jun 2016 14:57:40 -0400 From: Tejun Heo To: Johannes Weiner Cc: Li Zefan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH cgroup/for-4.8] cgroup: allow NULL return from ss->css_alloc() Message-ID: <20160621185740.GR3262@mtj.duckdns.org> References: <20160621170624.GK3262@mtj.duckdns.org> <20160621181404.GB4501@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160621181404.GB4501@cmpxchg.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, Jun 21, 2016 at 02:14:04PM -0400, Johannes Weiner wrote: > Would it be better to remove the error code instead and have everybody > return NULL? AFAICS, everybody is returning either the object or the > -ENOMEM error code right now. > > What error condition is there for an allocation function? I already changed cgroup core to interpret NULL return as -ENOMEM. Maybe we can drop ERR_PTR handling altogether in the future but I'm not sure. e.g. memcg's id allocation and -ENOSPC check could be in css_alloc. The thing is css_online is only necessary if there are requirements around css id or iteration, so css_alloc can easily be the only alloc / init point and thus should be able to indicate different failure conditions. Thanks. -- tejun