Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp387472img; Wed, 20 Mar 2019 23:41:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjP/W3TnwRLscU50C/gtR8PnO8kkM+U/b2GMzf+0Wo7i2XZOb3idJUr6FXMCn+HmPJrp30 X-Received: by 2002:a63:e050:: with SMTP id n16mr1928277pgj.210.1553150505971; Wed, 20 Mar 2019 23:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553150505; cv=none; d=google.com; s=arc-20160816; b=JPgJEMedotxjiXXr8cXY37fHbiczHuXqaevvYJqvMJHp7q528xwUW3HVHOK+lb7iAe JnGdVvGoEeOREWt8aEsXvKGchWAUXM0LZBFgSWXiPzvVqM0BiMbtKCDKdzDqf0V9KnYp 2bnyLpkTMCgIxsuLDv2sVntKuk9Vtaozka0dH6hykeiLtwqLwFGqo05FmVUD/ORlcvmf WlHvmtYvQRS+gJIfeVrTa/lHADiE6F1Ye7PbV07/JaYbcg5B8y8JSJi/IUcQWlE2jFkJ nYRA5ZtVf5ciqj4AE9gsT4kGsFJsKQlM6xbj+91hlfNLDBzF2jJxdZcrQEyo5xe/VQQE 7oEw== 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; bh=QaLhh/3OuZaX+FKb+DW2jMDXLiQw+/brcwP91+Z0wbM=; b=Kup77AE6myMHUPuBDxnszN3LZyqcYyxe3QyF+ADR1bLWuSuhFfUU+cXQ2cjTbqOree tyiUbvpigOjluU9ajNQ/7IwYM7Mzx59XtsJawyZLdpj8ASdChLYbqMfRXa3xIsUx3LhG w3KkLHBIOgXSFWw1mOI7u8nkr6FKjQTExX0ClwRvwqMVgmG+Sz/fRUIBWJ9hlP5HKnS5 PxQ82x04lc01jItAJStCok5oivSp1uxkY6SDMaUjXWvZ+x5qQBZlxv5OPWhhc5kiwSnm U5Nm1DDEHhhBnCuyY/THHCUznBcHv0+JW1dPU2w/0kSUDYZGJlkaggVGAnmNF/sRKCn8 IlDw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si3583187pfj.16.2019.03.20.23.41.30; Wed, 20 Mar 2019 23:41:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727811AbfCUGkj (ORCPT + 99 others); Thu, 21 Mar 2019 02:40:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43344 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727661AbfCUGkj (ORCPT ); Thu, 21 Mar 2019 02:40:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C03C20269; Thu, 21 Mar 2019 06:40:39 +0000 (UTC) Received: from localhost (ovpn-12-72.pek2.redhat.com [10.72.12.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2CBDA600C1; Thu, 21 Mar 2019 06:40:31 +0000 (UTC) Date: Thu, 21 Mar 2019 14:40:29 +0800 From: Baoquan He To: Matthew Wilcox , Mike Rapoport , Oscar Salvador Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, pasha.tatashin@oracle.com, mhocko@suse.com, rppt@linux.vnet.ibm.com, richard.weiyang@gmail.com, linux-mm@kvack.org Subject: Re: [PATCH 1/3] mm/sparse: Clean up the obsolete code comment Message-ID: <20190321064029.GW18740@MiWiFi-R3L-srv> References: <20190320073540.12866-1-bhe@redhat.com> <20190320111959.GV19508@bombadil.infradead.org> <20190320122011.stuoqugpjdt3d7cd@d104.suse.de> <20190320122243.GX19508@bombadil.infradead.org> <20190320123658.GF13626@rapoport-lnx> <20190320125843.GY19508@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190320125843.GY19508@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 21 Mar 2019 06:40:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, On 03/20/19 at 05:58am, Matthew Wilcox wrote: > On Wed, Mar 20, 2019 at 02:36:58PM +0200, Mike Rapoport wrote: > > There are more than a thousand -EEXIST in the kernel, I really doubt all of > > them mean "File exists" ;-) > > And yet that's what the user will see if it's ever printed with perror() > or similar. We're pretty bad at choosing errnos; look how abused > ENOSPC is: When I tried to change -EEXIST to -EBUSY, seems the returned value will return back over the whole path. And -EEXIST is checked explicitly several times during the path. acpi_memory_enable_device -> __add_pages .. -> __add_section -> sparse_add_one_section Only look into hotplug path triggered by ACPI event, there are also device memory and ballon memory paths I haven't checked carefully because not familiar with them. So from the checking, I tend to agree with Oscar and Mike. There have been so many places to use '-EEXIST' to indicate that stuffs checked have been existing. We can't deny it's inconsistent with term explanation text. While the defense is that -EEXIST is more precise to indicate a static instance has been present when we want to create it, but -EBUSY is a little blizarre. I would rather see -EBUSY is used on a device. When want to stop it or destroy it, need check if it's busy or not. #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ Obviously saying resource busy or not, it violates semanics in any language. So many people use EEXIST instead, isn't it the obsolete text's fault? Personal opinion. Thanks Baoquan > > $ errno ENOSPC > ENOSPC 28 No space left on device > > net/sunrpc/auth_gss/gss_rpc_xdr.c: return -ENOSPC; > > ... that's an authentication failure, not "I've run out of disc space".