Received: by 10.192.165.156 with SMTP id m28csp450456imm; Fri, 13 Apr 2018 01:58:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Dq9qbK/jrZDa+99umI7iFJNfVmCKg+yeeTOI8bpbZYrR+Epp/IEEgzHzoYB6eDQInQJac X-Received: by 2002:a17:902:4003:: with SMTP id b3-v6mr4442668pld.15.1523609883523; Fri, 13 Apr 2018 01:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523609883; cv=none; d=google.com; s=arc-20160816; b=Cn+9wClOFELTkaQDw032FBDirVYwLNis21y3/mVNkBB1uYa68ErSpTCFN+fFWUzDcl FJFnqZL9Mm5wEAPDwg20fo8cjn8pKbYKywbCv1Ne0TTwqMp/aWakBaXf0RwXBe6z9Gaq Qo56KOC156rMIxxHsJBANRyJQV5C64wnTR1gy518UIY5sZveVLQVV00ZYoLj74VPeB9F oFIJi+pbe5BfEtJrTe/+zolNfH5MI5cGwpWZHyL7FLziDwbcP71dKybOnxr7OUjpIByb R2pDj1m9qxHQ0upRydkE1xsO2h5cAFsGO5suXnZ0jlmtx6SFhl5omA7jFWEq4iVxswJl CpPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=z3UgrRBMrt9mtF3PYRnk6EUS/d/8EkOzE6vbNe4XWVU=; b=spGdd7zGix3H7euSg6A09njnrmeOMEYh442Pwr1wRQRgJXxaDccIf1Ju8+J5DxA4x8 sDb3rViEnMm660XIqaR1THQ635yzXnP9ZfjVHsHpZlp9t8YhbwPbk68NNdql2hO93rYP ui69O50vva8lWymCA6oO+1U34bHePOa2T0Eu4VgV9NQqz62f0wgmIx3yO5dxcIPwlGJs N4TPcfbZnJKuTfUdR+EW8er3p49wen3hnOwBx4G7blYGbqaW03/6+L8rXa1NgsK0TNRs ZyJCiTlMBcLBfkjUyPzw6kNNduc8MsIdbmdxT0H5TAAuptqICOcEfOXCTWkxN4vUhNsn pZIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2-v6si5225155pli.669.2018.04.13.01.57.49; Fri, 13 Apr 2018 01:58:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754126AbeDMIz6 (ORCPT + 99 others); Fri, 13 Apr 2018 04:55:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:52216 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751421AbeDMIz4 (ORCPT ); Fri, 13 Apr 2018 04:55:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 714B1AC4A; Fri, 13 Apr 2018 08:55:55 +0000 (UTC) Date: Fri, 13 Apr 2018 10:55:53 +0200 From: Michal Hocko To: Kirill Tkhai Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg: Remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure Message-ID: <20180413085553.GF17484@dhcp22.suse.cz> References: <152354470916.22460.14397070748001974638.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152354470916.22460.14397070748001974638.stgit@localhost.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 12-04-18 17:52:04, Kirill Tkhai wrote: [...] > @@ -4471,6 +4477,7 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) > > return &memcg->css; > fail: > + mem_cgroup_id_remove(memcg); > mem_cgroup_free(memcg); > return ERR_PTR(-ENOMEM); > } The only path which jumps to fail: here (in the current mmotm tree) is error = memcg_online_kmem(memcg); if (error) goto fail; AFAICS and the only failure path in memcg_online_kmem memcg_id = memcg_alloc_cache_id(); if (memcg_id < 0) return memcg_id; I am not entirely clear on memcg_alloc_cache_id but it seems we do clean up properly. Or am I missing something? -- Michal Hocko SUSE Labs