linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Tatashin <pasha.tatashin@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: osalvador@techadventures.net, Michal Hocko <mhocko@suse.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	osalvador@suse.de
Subject: Re: [PATCH 1/4] mm/memory_hotplug: Make add_memory_resource use __try_online_node
Date: Wed, 20 Jun 2018 21:41:35 -0400	[thread overview]
Message-ID: <CAGM2reYgrpBrfhcw0O7K+sMU-qE-U_+2MzJWsG=7gSbU8n-=kA@mail.gmail.com> (raw)
In-Reply-To: <20180620151819.3f39226998bd80f7161fcea5@linux-foundation.org>

> I don't think __try_online_node() will ever return a value greater than
> zero.  I assume what was meant was

Hi Andrew and Oscar,

Actually, the new __try_online_node()  returns:
1 -> a new node was allocated
0 -> node is already online
-error -> an error encountered.

The function simply missing the return comment at the beginning.

Oscar, please check it via ./scripts/checkpatch.pl

Add comment explaining the return values.

And change:
        ret = __try_online_node (nid, start, false);
        new_node = !!(ret > 0);
        if (ret < 0)
                goto error;
To:
        ret = __try_online_node (nid, start, false);
        if (ret < 0)
                goto error;
        new_node = ret;

Other than that the patch looks good to me, it simplifies the code.
So, if the above is addressed:

Reviewed-by: Pavel Tatashin <pasha.tatashin@oracle.com>

Thank you,
Pavel

>
>         new_node = !!(ret >= 0);
>
> which may as well be
>
>         new_node = (ret >= 0);
>
> since both sides have bool type.
>
> The fact that testing didn't detect this is worrisome....
>
> > +     if (ret < 0)
> > +             goto error;
> > +
> >
> >       /* call arch's memory hotadd */
> >       ret = arch_add_memory(nid, start, size, NULL, true);
> > -
> >       if (ret < 0)
> >               goto error;
> >
> >
> > ...
> >
>

  reply	other threads:[~2018-06-21  1:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 12:53 [PATCH 0/4] Small cleanup for memoryhotplug osalvador
2018-06-01 12:53 ` [PATCH 1/4] mm/memory_hotplug: Make add_memory_resource use __try_online_node osalvador
2018-06-07 10:48   ` Jonathan Cameron
2018-06-20 22:18   ` Andrew Morton
2018-06-21  1:41     ` Pavel Tatashin [this message]
2018-06-21  7:33       ` Oscar Salvador
2018-06-01 12:53 ` [PATCH 2/4] mm/memory_hotplug: Call register_mem_sect_under_node osalvador
2018-06-21  2:03   ` Pavel Tatashin
2018-06-01 12:53 ` [PATCH 3/4] mm/memory_hotplug: Get rid of link_mem_sections osalvador
2018-06-21  2:35   ` Pavel Tatashin
2018-06-25 17:04   ` Jonathan Cameron
2018-06-25 17:34     ` Oscar Salvador
2018-06-01 12:53 ` [PATCH 4/4] mm/memory_hotplug: Drop unnecessary checks from register_mem_sect_under_node osalvador
2018-06-21  2:38   ` Pavel Tatashin
2018-06-07 10:42 ` [PATCH 0/4] Small cleanup for memoryhotplug Jonathan Cameron
2018-06-07 13:32   ` Oscar Salvador
2018-06-18  7:13 ` Oscar Salvador
2018-06-21  8:32 ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGM2reYgrpBrfhcw0O7K+sMU-qE-U_+2MzJWsG=7gSbU8n-=kA@mail.gmail.com' \
    --to=pasha.tatashin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=osalvador@techadventures.net \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox