Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp599088img; Wed, 20 Mar 2019 07:09:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx4cEj0IhF1KQtqX3klqVxY7KwvWNdW9d8gAePd3nFuCPmE/xDZrjlUHIIS3aG1ca11gAm X-Received: by 2002:a17:902:24:: with SMTP id 33mr8323254pla.259.1553090971790; Wed, 20 Mar 2019 07:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553090971; cv=none; d=google.com; s=arc-20160816; b=Kq4fXlVThelxb3lxVxKADVcv0y06Tddkb/ToxoseYzhr2OOYaFgBG+DUx5jIa0DqjT 9gjzY8CkTybV56GzWqDyM73WW2cX6OSQmnlNuvB6Uh0UcuNIEWj72TVjf2kTJr6acCEI JHBE5uChxkFwbwqlminyo9TmJV2g2QICfAm/jVJ8oxHbTN1ReybcaAqErG6S03XcXoks K6u/nDo2Y4qmomSkk0Rqm2ZHJDUTzScGT5zCtKmHn32x3QQsk+uweojSemH6dqj6hfKF bmglBS2GcH0aonvBTu0+dJO/H20Y3I2giWKCN9l56rKW1qpgPpwQHvUAwDXbPiRtgZ06 JoKg== 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=dXFvDyITa9NwkF6sB26uyWuSNb1aa4yRdxMiNFZX7Ec=; b=It25OGgTfBc39yJa05ttiKPrv7K8reHZhmAdjibA1TTJFQ/+Z7Ctgn32LqCVrpH0z7 1Pv71an94RRbkxwM4xA4SXt88Zeq4c7SUd+6Nknv7Em7Y0q0OwhA4FGJW+TIxwl6wvkd eznJLoCqPWis0/07w2F3THrViFw9X02FRerQfsC7jY7PuUMiA0UUIfpyHtNHlM1HNrZM UlEUysYatIUKwx+fTxZUAZ87fD//C15gYAoHfgsGRjQvf684krmkESmG1B0qVfUzXaNd tONI/y/wQINvzIeMCJD0MgHTptxZyPTYVfaWRFEe5HjR01vo7wWRGvEBdUvMii1yj+ow N2YQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck9si2037899plb.196.2019.03.20.07.09.16; Wed, 20 Mar 2019 07:09:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727585AbfCTMUR (ORCPT + 99 others); Wed, 20 Mar 2019 08:20:17 -0400 Received: from charybdis-ext.suse.de ([195.135.221.2]:16898 "EHLO suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726366AbfCTMUQ (ORCPT ); Wed, 20 Mar 2019 08:20:16 -0400 Received: by suse.de (Postfix, from userid 1000) id 6683C4622; Wed, 20 Mar 2019 13:20:15 +0100 (CET) Date: Wed, 20 Mar 2019 13:20:15 +0100 From: Oscar Salvador To: Matthew Wilcox 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: <20190320122011.stuoqugpjdt3d7cd@d104.suse.de> References: <20190320073540.12866-1-bhe@redhat.com> <20190320111959.GV19508@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190320111959.GV19508@bombadil.infradead.org> User-Agent: NeoMutt/20170421 (1.8.2) 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 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. -- Oscar Salvador SUSE L3