Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp507816img; Wed, 20 Mar 2019 05:25:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqdPP3Ooo6ro1EVuxcZwzVXmjaX9bA0iJe8IuhdfyEbIv1CcW9OrYhFIOEuu8BgzuDgYa3 X-Received: by 2002:a17:902:b216:: with SMTP id t22mr8134730plr.39.1553084716099; Wed, 20 Mar 2019 05:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553084716; cv=none; d=google.com; s=arc-20160816; b=j2iTmvhROF/EWKBXM/VHvSUNGLwCupOMyhKBIeI6QtDfunbREYRC2Xb0sCmgiUjxW9 sasM+o9Rja84OTxwCB5YbeI8NoDtxmLbVxeV4gmNomYz3M/mAOz2LmmUejf7szdOvgu2 gMbnV/CkgyaQIqe2TwMfsK83f1g2eYnKg0gSiyOfo2mj+/e6RtntF6g73Mj5PkPWt8+z TbclCUczLZ25n/o/qTYYBME/Irx/6d00orpReYOI0r1zOHmyHgllwF/RgJ5o6419ToDs Lfi4wpTo+AmOXPHNML8IVU787HDRTGYyclQqniQ8exHhmCYClo3Uz/E0aBm1wgJadqJv HIpQ== 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:dkim-signature; bh=ejrv0nqkLXOAsoIVPvdcwyaIsyNTGVSm3cYDYSD+qBs=; b=z/dl8aPDglq3wJkoidL9Ec5F2GMcNAQKcAGORQZmUNiuD/wJC+AAYX3FxfrcZsLjIm bUrBbIAwY65WklYp3hkN/tB8r7KwI49OghiG4edAZnApx5DV3qtO7xSxsZP4EPOAXB2p G2Y6nKenIFmtKt9+8Rk9eS6T+BpKHbBX7gH1seK3PXJN6KlWi42O/5w5uj0Rwl/KZX5I Jaeu4RvCv3aEclchhKSaH1hkheemCQAVSZgB5WRVYfd+xsBipzy992byWW7GfJeYjk22 IxhtQ70hpA4UYITSPupnHKdz0TDcGX4oguxrDhYXcHvQnG3VqzYEqVDh/LzzaNpWTy+P c1UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GX5RAa3T; 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 f12si1557078pgm.355.2019.03.20.05.25.00; Wed, 20 Mar 2019 05:25:16 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GX5RAa3T; 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 S1727540AbfCTMWq (ORCPT + 99 others); Wed, 20 Mar 2019 08:22:46 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52778 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726366AbfCTMWq (ORCPT ); Wed, 20 Mar 2019 08:22:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ejrv0nqkLXOAsoIVPvdcwyaIsyNTGVSm3cYDYSD+qBs=; b=GX5RAa3TvNQstzO1FefE+h/nH LSsPPn50RTM9BP3g+9uJboDdj1nDSvYlWtYDsFmgjL5YB6nzEya103QAOoIG90wCz6sfX98rsRgsX azIT2YcKnlGnWTJX0QEgSsa5eHnzeGIifpWjJLS41dYBEEMAvmfH0AkZaoB3yyBwCUl1+AWogfRK0 dR8+IPK9CBJeyvTKu1R2miHNWfYcMWraaBQcrJEyxskgZV/AAQF9IOI0f/C4dSqHo8MgXDEzLMLQ9 6v8W0j9Bzk8Fliao9jYHwrQz3WxMY1qZz3+iezeMf1C1AjNgJ0uv3c8V5Z4cB7A5Ja6fVAn3QkPdX V0ZYrn3/Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6aF2-0005mM-2J; Wed, 20 Mar 2019 12:22:44 +0000 Date: Wed, 20 Mar 2019 05:22:43 -0700 From: Matthew Wilcox To: Oscar Salvador Cc: Baoquan He , 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: <20190320122243.GX19508@bombadil.infradead.org> References: <20190320073540.12866-1-bhe@redhat.com> <20190320111959.GV19508@bombadil.infradead.org> <20190320122011.stuoqugpjdt3d7cd@d104.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190320122011.stuoqugpjdt3d7cd@d104.suse.de> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 20, 2019 at 01:20:15PM +0100, Oscar Salvador wrote: > On Wed, Mar 20, 2019 at 04:19:59AM -0700, Matthew Wilcox wrote: > > On Wed, Mar 20, 2019 at 03:35:38PM +0800, Baoquan He wrote: > > > /* > > > - * returns the number of sections whose mem_maps were properly > > > - * set. If this is <=0, then that means that the passed-in > > > - * map was not consumed and must be freed. > > > + * sparse_add_one_section - add a memory section > > > + * @nid: The node to add section on > > > + * @start_pfn: start pfn of the memory range > > > + * @altmap: device page map > > > + * > > > + * Return 0 on success and an appropriate error code otherwise. > > > */ > > > > I think it's worth documenting what those error codes are. Seems to be > > just -ENOMEM and -EEXIST, but it'd be nice for users to know what they > > can expect under which circumstances. > > > > Also, -EEXIST is a bad errno to return here: > > > > $ errno EEXIST > > EEXIST 17 File exists > > > > What file? I think we should be using -EBUSY instead in case this errno > > makes it back to userspace: > > > > $ errno EBUSY > > EBUSY 16 Device or resource busy > > We return -EEXIST in case the section we are trying to add is already > there, and that error is being caught by __add_pages(), which ignores the > error in case is -EXIST and keeps going with further sections. > > Sure we can change that for -EBUSY, but I think -EEXIST makes more sense, > plus that kind of error is never handed back to userspace. Not returned to userspace today. It's also bad precedent for other parts of the kernel where errnos do get returned to userspace.