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,URIBL_BLOCKED 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 10C1DC2BA16 for ; Tue, 7 Apr 2020 06:43:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D048F20644 for ; Tue, 7 Apr 2020 06:43:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D048F20644 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 7E0F48E000D; Tue, 7 Apr 2020 02:43:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B7938E0001; Tue, 7 Apr 2020 02:43:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CD678E000D; Tue, 7 Apr 2020 02:43:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 55C8F8E0001 for ; Tue, 7 Apr 2020 02:43:34 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 24E31180AD806 for ; Tue, 7 Apr 2020 06:43:34 +0000 (UTC) X-FDA: 76680117948.08.shoes84_766f4cb1b3c44 X-HE-Tag: shoes84_766f4cb1b3c44 X-Filterd-Recvd-Size: 5142 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 06:43:33 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id v5so2439636wrp.12 for ; Mon, 06 Apr 2020 23:43:33 -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=/g1Y9v8fFu9c3OijQ4L6kz2GZtWNUlMj0hDLUpQkWjE=; b=NwykkE8x3EtaF7GrJFW3cZ0+KjfgdFqsKUKP+qakqsDcfyTiSsuMY0l9d1KAwm+U3r +oXFgWnLPqaWzo1eySiCk6Iof9I+dWfpTiV3jGpj5b0K8l6az6QeYTO55MM+NxCpiYOX CHV/3NgQAlc+7El+nVpjWvCwnzGPVAaGE3bQLmRtZ0QJ3zNBzFXWIYH6QYN/NBOP9hRA Orz61jJK3p7zd76MlO4+mlSU5bV01zksRRtavAlIQZ0DG8V69R8xvYVZLVqvA/TEi/HX fQdegyv+bg8Q8iIkSLC9MYnkP82KiGnd1OU9NFTJ0Q4HYKIy48z4Gvg1mXNBHpA+DKho FpIw== X-Gm-Message-State: AGi0PuYfEt9WJLGzLFg+idEX9cST8bk9tth64aXGknXpn+Yam4iFvc1p jf9xihXSLGOVE+D4FO1VXwh7b/jM X-Google-Smtp-Source: APiQypI6A+3+G8HZ1913GmRGCWVyACR8WfjJl0/XvuztIcC0V4gFXPoyNskgQITbVi/Vpk11AX+Sdg== X-Received: by 2002:adf:e942:: with SMTP id m2mr973158wrn.364.1586241812838; Mon, 06 Apr 2020 23:43:32 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id s13sm13507843wrw.20.2020.04.06.23.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 23:43:31 -0700 (PDT) Date: Tue, 7 Apr 2020 08:43:29 +0200 From: Michal Hocko To: Yafang Shao Cc: Andrew Morton , Matthew Wilcox , Johannes Weiner , Vladimir Davydov , Linux MM Subject: Re: [PATCH v3] mm, memcg: fix error return value of mem_cgroup_css_alloc() Message-ID: <20200407064329.GB18914@dhcp22.suse.cz> References: <1586192163-20099-1-git-send-email-laoar.shao@gmail.com> <20200406162343.6ae4b8f74c74bcb84d026471@linux-foundation.org> <20200406200916.2623f34403155264d8c8e9e7@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: [I have only now noticed there was another version posted. Please try to wait a bit longer for other feedback before reposting a newer version] On Tue 07-04-20 11:11:13, Yafang Shao wrote: > On Tue, Apr 7, 2020 at 11:09 AM Andrew Morton wrote: > > > > On Tue, 7 Apr 2020 11:02:31 +0800 Yafang Shao wrote: > > > > > On Tue, Apr 7, 2020 at 7:23 AM Andrew Morton wrote: > > > > > > > > On Tue, 7 Apr 2020 00:56:03 +0800 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(). See my comment about EBUSY in the previous version http://lkml.kernel.org/r/20200407063621.GA18914@dhcp22.suse.cz > > > > > 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 > > > > > > > > Thanks. > > > > > > > > Was a -stable backport considered? > > > > > > I only backported to our kernel version 4.18, but I'm not sure whether > > > it will apply to -stable or not. > > > Seems this issue is introduced long time ago. I will try to backport > > > it to -stable. > > > Should I try it based on 5.5.y and 5.6.y only ? Or all the LTS kernel > > > versions ? > > > > What I'm asking (of you and of reviewers) is whether this issue is > > sufficiently serious to require fixing in -stable kernels. The > > patch merging details can be sorted out later. > > > > > > I think it is worth to cc stable, as this errno will mislead the user. We have idr failure path since 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") which is more than four years ago without anybody ever noticing. While I do agree that the existing behavior might be confusing I am not really sure this qualifies as stable material TBH. -- Michal Hocko SUSE Labs