From patchwork Fri Jul 6 21:23:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10512547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6967D6024A for ; Fri, 6 Jul 2018 21:23:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59C8D287E0 for ; Fri, 6 Jul 2018 21:23:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DF04287EF; Fri, 6 Jul 2018 21:23:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37059287E5 for ; Fri, 6 Jul 2018 21:23:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9B786B0003; Fri, 6 Jul 2018 17:23:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D49C96B0005; Fri, 6 Jul 2018 17:23:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C39896B0006; Fri, 6 Jul 2018 17:23:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id 6CF2B6B0003 for ; Fri, 6 Jul 2018 17:23:31 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id w21-v6so8136268wmc.4 for ; Fri, 06 Jul 2018 14:23:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:date:from:to :cc:subject:message-id:references:mime-version:content-disposition :in-reply-to:user-agent; bh=thi0DSX2sAOi0pFHz7c9yxGly7b6YkqtJDRpM9XbMx4=; b=Bu6j1Tj7+DcyZRUgOD//rA00so1od6wJdV4EBFDvznq+XVXJpic7yYddNTICY1dfUG HafuvJ5J8nRn6VuS74S7YXqSJo+nmESLHbsPZTOUYeWk59jLSV/tHMwmt1inQJPbdXzK QkHKHExEHv7r5XRSTPbsHAx/FE5UupsObQGDwaWgdbtZYEzmqhVm/D5PB5p2FcYad201 9xqsNzTJwzc54bbAxRo1BhBLauoqff80Fbx3fCWIlhv8Szix0QBZR+KnmAsG5/c22Rry xF1stBDPY9mKjxTN2T3Os0NbuCwgH4FCr4VJSQCbd1U5+e6VK1wDVxBTnIc7sohnlHkh btpQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: APt69E2VhqZUhv0yF4CtefZPYsR4HclOzGJ7fycgyfRTGPoeTIz8y3aY 9ZA3WqkB4prC7E/8rdD1VcxEEI3TVn9UNG4XLnec7jTyPn8H5/I5IiN5ZhYNHYkhgDQKQR9FohR m4J8V4yEvXVlXPRXcx2aezLLqlFEItqK65mU/tU4lQLuyZIWx/p5Nlzlmg3CMgJQF3b4R2/YYlI hcLix3HsMi/H2Qd+5QNkFikN06yb5GJKdcDyin1t+rnfSbpDMIdufnlM8aAm3KRIaW0uOLe4q1Y 9tcocN7gs/9ZKkXBcFaGMbfOV/YXFNHjQ5Eq31yDO+JbbIIRG5cmNn4Rvvfk3IT5ErruXaJyMPA WLIkf700vYFY/R04TEHezdhXEekDw/fe4TCVvyBU8PtuEubeMb6/pCqPdcxXEca2KmthcB4iGw= = X-Received: by 2002:adf:b587:: with SMTP id c7-v6mr8301819wre.141.1530912210884; Fri, 06 Jul 2018 14:23:30 -0700 (PDT) X-Received: by 2002:adf:b587:: with SMTP id c7-v6mr8301797wre.141.1530912209932; Fri, 06 Jul 2018 14:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530912209; cv=none; d=google.com; s=arc-20160816; b=r83wCe5P22oytNY3AstjvqAUH19fXo/yXExHFPHyEa34nBk5jw4u2ysntM36DZXMwT nSf3d4SQcjA8AloHvkBYZMunzs5bZVTNooJddA6RAMd/lZAN/0rS0HSXs97tkN0B2jVc xBvbNQBxasxB323sNwWHLZE1IzXKLQpvMR7Jb6dWbEO0EwpqE3PpMj5bBM9M7C25HRTw iG9njXj1HTO7oRE98bOFjwrEV4WOp+YpTU9YkVaOdB+C8boM02ZIfiSIyg8mgtiHWCLJ EC0XpdYUW27x76Uy9EoTvE4S4bkwLBEVaih38E2OpPHyF3L4UbvcH9+40BKwyWNeiGqH HUmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:arc-authentication-results; bh=thi0DSX2sAOi0pFHz7c9yxGly7b6YkqtJDRpM9XbMx4=; b=J3rlmPBM/RFE9N6GB8POCbJakp1z3OzZGJqvjO16wvegI9Qj/p5yNNKH41U3U7del/ NbA4/oNjBKgw0wlNa28IVquhuD8i1xOZ4V9yfqngeaT2FpkzDVQBYvPTNJStvGZCPx0N AIqrfuyZop1Odo7/wT9znPIx9A0Ubnn4P/Rw3bzhnzsngL6/mE5wv29wSfACFzz+9ldu MsQ10O4I2AjGTpjD0tNbvXkDeBk/SWMhFczZsxTAtiL6B/RNanZfx7z1DrF8dSdLqB3S QZEYkzpLLgpivPwlWvSKCyredTuju/eMKFZ2Lpgr5Vty4j6YDAVZNsXkYG3nJf4eKaGZ +MYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t7-v6sor2210766wrp.50.2018.07.06.14.23.29 for (Google Transport Security); Fri, 06 Jul 2018 14:23:29 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AAOMgpf6fgRTQpUtW2a5uLxh05qd2gJ9mlb5NeWNZ57bK3kQb6sxgO6zV8ErmtY5FsCq7kRgQmH3Sg== X-Received: by 2002:adf:af45:: with SMTP id z63-v6mr8260090wrc.238.1530912209268; Fri, 06 Jul 2018 14:23:29 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id p4-v6sm9177143wrj.71.2018.07.06.14.23.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jul 2018 14:23:28 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id B1966123C48; Fri, 6 Jul 2018 23:23:27 +0200 (CEST) Date: Fri, 6 Jul 2018 23:23:27 +0200 From: Oscar Salvador To: Ross Zwisler Cc: pasha.tatashin@oracle.com, linux-nvdimm@lists.01.org, bhe@redhat.com, Dave Hansen , LKML , Linux MM , Michal Hocko , Vlastimil Babka , Andrew Morton , "Kirill A. Shutemov" , osalvador@suse.de Subject: Re: [PATCH] mm/sparse.c: fix error path in sparse_add_one_section Message-ID: <20180706212327.GA10824@techadventures.net> References: <20180706190658.6873-1-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180706190658.6873-1-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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: X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 06, 2018 at 01:06:58PM -0600, Ross Zwisler wrote: > The following commit in -next: > > commit 054620849110 ("mm/sparse.c: make sparse_init_one_section void and > remove check") > > changed how the error handling in sparse_add_one_section() works. > > Previously sparse_index_init() could return -EEXIST, and the function would > continue on happily. 'ret' would get unconditionally overwritten by the > result from sparse_init_one_section() and the error code after the 'out:' > label wouldn't be triggered. My bad, I missed that. > diff --git a/mm/sparse.c b/mm/sparse.c > index 9574113fc745..d254bd2d3289 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -753,8 +753,12 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat, > * plus, it does a kmalloc > */ > ret = sparse_index_init(section_nr, pgdat->node_id); > - if (ret < 0 && ret != -EEXIST) > - return ret; > + if (ret < 0) { > + if (ret == -EEXIST) > + ret = 0; > + else > + return ret; > + } sparse_index_init() can return: -ENOMEM, -EEXIST or 0. So what about this?: SUSE L3 diff --git a/mm/sparse.c b/mm/sparse.c index f55e79fda03e..eb188eb6b82d 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -770,6 +770,7 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat, ret = sparse_index_init(section_nr, pgdat->node_id); if (ret < 0 && ret != -EEXIST) return ret; + ret = 0; Does this look more clean? -- Oscar Salvador