From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839C2C2BA16 for ; Tue, 7 Apr 2020 06:44:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DCA420692 for ; Tue, 7 Apr 2020 06:44:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DCA420692 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D84AD8E000E; Tue, 7 Apr 2020 02:44:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE7548E0001; Tue, 7 Apr 2020 02:44:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAEF98E000E; Tue, 7 Apr 2020 02:44:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id A18E98E0001 for ; Tue, 7 Apr 2020 02:44:26 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5C8A4181AC217 for ; Tue, 7 Apr 2020 06:44:26 +0000 (UTC) X-FDA: 76680120132.26.heart65_7e09c1793b51f X-HE-Tag: heart65_7e09c1793b51f X-Filterd-Recvd-Size: 3592 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 06:44:25 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id w15so2468858wrv.10 for ; Mon, 06 Apr 2020 23:44:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DQqZw/+4qOnp85v7S8y/lfthM1ozqVV6AUjZuxrJpDM=; b=mEVDkkbVGk+FumXOal7CCsTJQD8S70ZKHGBELAnF1hKtjqTPENVn95D3vpammPDEK8 2+3n+m8BOxe2dGSADHTq7/DJdwRTXudx4UP59uSXxR5sI/1gXiBDqo6rwRbyQ5SMAYjq ti1MAbxxFqLvZCzIQAVh9GmlE5CFR62zf1yTI+GeAJiHZkTd4lUi5WlKa5LSGhk6rM34 dCueBoPs6JUVOT6unC5dXlkL7I+xfbKhnTeJGrP0jRi2Jij22TSpli03po4BF89RTiN1 TAvB+47jv2Cz4GdKi//ZBVzjJb8Dt3X8AJI3+HdxBGyirKVWgbkqql9DYMotrmUH/ePv PmFg== X-Gm-Message-State: AGi0PuYuVgin4cChCByLCiU1AMf85asE5EcX+7Bdtl+PGnvzIncoYSEE qdpez+SB4sTUgryzeBUc5wZIXT3J X-Google-Smtp-Source: APiQypJFA0DHDru3DzPLBNS8Xe96ZraCrGdBGrG4NG6vuCutZHBM7UubCpThDTzNF6oUPtd+FB1dkA== X-Received: by 2002:a5d:4ac1:: with SMTP id y1mr954822wrs.174.1586241864972; Mon, 06 Apr 2020 23:44:24 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id n6sm30761779wrp.30.2020.04.06.23.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 23:44:24 -0700 (PDT) Date: Tue, 7 Apr 2020 08:44:23 +0200 From: Michal Hocko To: Yafang Shao Cc: willy@infradead.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm, memcg: fix error return value of mem_cgroup_css_alloc() Message-ID: <20200407064423.GC18914@dhcp22.suse.cz> References: <1586188134-17038-1-git-send-email-laoar.shao@gmail.com> <20200407063621.GA18914@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200407063621.GA18914@dhcp22.suse.cz> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 07-04-20 08:36:24, Michal Hocko wrote: > On Mon 06-04-20 23:48:54, Yafang Shao wrote: > > When I run my memcg testcase which creates lots of memcgs, I found > > there're unexpected out of memory logs while there're still enough > > available free memory. The error log is, > > mkdir: cannot create directory 'foo.65533': Cannot allocate memory > > > > The reason is when we try to create more than MEM_CGROUP_ID_MAX memcgs, an > > -ENOMEM errno will be set by mem_cgroup_css_alloc(), but the right errno > > should be -EBUSY "Device or resource busy". That is same with > > memcg_alloc_cache_id(). > > I do not see EBUSY being listed as expected return value for mkdir(2) > which is the primary way to create a cgroup. > > > As the errno really misled me, we should make it right. After this patch, > > the error log will be, > > mkdir: cannot create directory 'foo.65533': Device or resource busy > > I do see ENOMEM being slightly confusing but if we really need to fix > this then ENOSPC sounds like a better fit to me. Btw. I have just checked 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") and it explicitly talks about ENOSPC being returned prior to this patch. -- Michal Hocko SUSE Labs