Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp519709img; Wed, 20 Mar 2019 05:39:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMG/7M3pwEY8cXq/eeF+7drSf94b0FhD1q94jucM3pjRiOEgBlTBoKG5I91+mnGyiLhRF3 X-Received: by 2002:a17:902:8692:: with SMTP id g18mr7557678plo.149.1553085543164; Wed, 20 Mar 2019 05:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553085543; cv=none; d=google.com; s=arc-20160816; b=doUdOiJ4TjUMMo/C1wDswJDbTMw6S/YqmljKkE4K5gBdET3zxWq8vfAB8NIgs1HgIV OU+iS8uU3CF9KrUtL6A4qOUKUAvhntTp0gWXRVu0ZhbCqgIZxCiKXb6XKNZ4u9FZYF6A 8ELVr32dXaBQ0cn/SQYYwNCLxDmws5D1zoUt+PWEGhXZ9t9q1ENlbXAuztFifO930XZd MmQzkbNnPIEUc5msSLzkacGJfx1GiwIRHe2d6Swhi47719BlAlLxIxOt/VCXB6gbtGwO yoXQdv/asSeWP3q92s6+bJ6pXDVTAqas5qw88KsT+Jb44I2hyHDVTzLqba0gULuFYSCH gPnw== 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=xyJwayRb68V6HNNjxxEp1T8lIGN5MRbXxNPLvt0ylio=; b=BND+PVMuW135tGtQNyFxWQFYyyahFnNYMuhTYcnLwnw69BHVe6bPNJtuZnA9dTQd+H Rx+0HZEwAKErNemQUM4Pe0MoogB50106tPh5F2KTURqx6T/bD6+wbs6h2KxlIHgwAQoD yTHOhO1MqdvU9d255fO713pmeRuJ7Cx3BzwwSnnG+zhSnMxyzFEn6eOPeP687sTBs7hq G0mMpa7SQAZKM5M91L4oKfFU7s3Vay9PRcLNVWVtSfMao2cGY3rMRWlL5LxN8iartlTW ACgNVeGDfKysD24/Odjc8mRx5m0qiySF3iYEgdjbyElmUoey5ZKfdW681op5W3MBxZPU 5y2g== 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 r18si1673232pgd.585.2019.03.20.05.38.47; Wed, 20 Mar 2019 05:39:03 -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 S1727862AbfCTMht (ORCPT + 99 others); Wed, 20 Mar 2019 08:37:49 -0400 Received: from nat.nue.novell.com ([195.135.221.2]:3601 "EHLO suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727622AbfCTMhs (ORCPT ); Wed, 20 Mar 2019 08:37:48 -0400 Received: by suse.de (Postfix, from userid 1000) id 9F981462C; Wed, 20 Mar 2019 13:37:47 +0100 (CET) Date: Wed, 20 Mar 2019 13:37:47 +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: <20190320123747.vzreusrqx74zkdfm@d104.suse.de> References: <20190320073540.12866-1-bhe@redhat.com> <20190320111959.GV19508@bombadil.infradead.org> <20190320122011.stuoqugpjdt3d7cd@d104.suse.de> <20190320122243.GX19508@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190320122243.GX19508@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 05:22:43AM -0700, Matthew Wilcox wrote: > 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. Yes, I get your point, but I do not really see -EBUSY fitting here. Actually, we do have the same kind of situation when dealing with resources. We return -EEXIST in register_memory_resource() in case the resource we are trying to add conflicts with another one. I think that -EEXIST is more intuitive in that code path, but I am not going to insist. -- Oscar Salvador SUSE L3