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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 4E60DC2BABC for ; Tue, 7 Apr 2020 09:32:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0276020719 for ; Tue, 7 Apr 2020 09:32:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tbf0PFwW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0276020719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0AB218E0018; Tue, 7 Apr 2020 05:32:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05D0F8E0001; Tue, 7 Apr 2020 05:32:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8DDE8E0018; Tue, 7 Apr 2020 05:32:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id CA11F8E0001 for ; Tue, 7 Apr 2020 05:32:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8E5B412641 for ; Tue, 7 Apr 2020 09:32:10 +0000 (UTC) X-FDA: 76680542820.07.berry12_875e7a8b80240 X-HE-Tag: berry12_875e7a8b80240 X-Filterd-Recvd-Size: 6509 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 09:32:10 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id t11so2539782ils.1 for ; Tue, 07 Apr 2020 02:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YXGKfia2x0o7hn5QJIP84jeuZBNzGhI+ulGToBIDCJA=; b=Tbf0PFwWeba1dBvsweiCADAuywhXt7HVnGEO6jUfCiHUz/PIMRWcW4YEvThY/A0MO7 hhsUZT9yBTQZCMckiEZrHmrPfxR6VxeolwmW88GCGaoxD5urarouUgrAKGykQjrUEgsa dyr4nUejKuIb88DKiukJybvdgD/kWO9amqS/9CdqW9HGuqAMda6jLcnuiBAHRhUsjr7/ 3sPYz+Wh9UQdqbkBZQ/A0C6RAS70Gce818N2192pZQi2cfToIp5ICMacVJMmmhjHiJ7s yv7YVJA9tDLoxLAnWtJflFJkeZySWgpzurmFYL0XA03Ho9WWwRa9smTpWmwwgXAufdGN 0HXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YXGKfia2x0o7hn5QJIP84jeuZBNzGhI+ulGToBIDCJA=; b=QbY2Z23w5y+4t8Iy9xuKJHf59LHsQOIbAFofb2VQw0usB+/qCBUBF/rG/7wnUOAuPP d9sq+k/Z30AViIdJzr94EbERJVA8O1W8deKYUNmTQ1s3hYbBm7liNanCjeh/jhSDJBI9 yi5DQQS5wywfdSeY9EuQaLB9avI+/fYPw/RpY8ozdwXOOHFWtoemETs6pB1DF/fPlL8m SHm7h4Wwzx1XMaKX6XUAlNiSOE2Rq8DDs3vUZ6FUDbRRpgS2SvvioM5SKJl4IcTMm4Q5 gBZ6dj/t4kYWbnG4a3Ru7pti7E6DI/ay/xTsTNalI04Nj5EAeio8NbeQXdrSCDRxjKFc F6QQ== X-Gm-Message-State: AGi0PuYBATYS+J+mkCedcL8UzuMNOW13aZ7TysljuYFLtJL6kOIeKPsQ aNZZN5uYprkUm3InvcHGHOZnxXluolDj+AwTog0= X-Google-Smtp-Source: APiQypJQD/J3nW9DR/Ku0ZxeYybBANg2q6BhJuZKIrxAePD+Vkj3Gu2j2yoTvFfj0PTjM+UYKwdHMQbL78inn+vP8rU= X-Received: by 2002:a92:835b:: with SMTP id f88mr1518850ild.137.1586251929518; Tue, 07 Apr 2020 02:32:09 -0700 (PDT) MIME-Version: 1.0 References: <1586192163-20099-1-git-send-email-laoar.shao@gmail.com> <20200406162343.6ae4b8f74c74bcb84d026471@linux-foundation.org> <20200406200916.2623f34403155264d8c8e9e7@linux-foundation.org> <20200407064329.GB18914@dhcp22.suse.cz> In-Reply-To: <20200407064329.GB18914@dhcp22.suse.cz> From: Yafang Shao Date: Tue, 7 Apr 2020 17:31:33 +0800 Message-ID: Subject: Re: [PATCH v3] mm, memcg: fix error return value of mem_cgroup_css_alloc() To: Michal Hocko Cc: Andrew Morton , Matthew Wilcox , Johannes Weiner , Vladimir Davydov , Linux MM Content-Type: text/plain; charset="UTF-8" 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: On Tue, Apr 7, 2020 at 2:43 PM Michal Hocko wrote: > > [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] > Sure I will. sorry about that. But after we send a patch, we always don't know in which state this patch is, e.g. Changes Requested, Not Applicable, Rejected, Needs Review / ACK and etc, as listed in netdev list[1]. That could give us an explicit instruction on what to do next. [1]. https://patchwork.ozlabs.org/project/netdev/list/?state=*&page=2¶m=3 > 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 > >From the perspective of mkdir(2), it is better to use ENOSPC here. But I'm not sure whether it is better to update the man page of mkdir(2) or not. I checked the explaination about ENOSPC in 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") carefully, but I don't a clear idea which one is better now. Per Matthew, EBUSY is better, while per you, ENOSPC is better. Matthew, would you mind to give more detailed explanation ? > > > > > > 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. OK Thanks Yafang