From: "liupeng (DM)" <liupeng256@huawei.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: <bhelgaas@google.com>, <tglx@linutronix.de>, <mingo@redhat.com>,
<bp@alien8.de>, <dave.hansen@linux.intel.com>, <x86@kernel.org>,
<hpa@zytor.com>, <lorenzo.pieralisi@arm.com>,
<guohanjun@huawei.com>, <sudeep.holla@arm.com>,
<rafael@kernel.org>, <lenb@kernel.org>,
<akpm@linux-foundation.org>, <logang@deltatee.com>,
<martin.oliveira@eideticom.com>, <thunder.leizhen@huawei.com>,
<axboe@kernel.dk>, <kch@nvidia.com>, <ming.lei@redhat.com>,
<shinichiro.kawasaki@wdc.com>, <mcgrof@kernel.org>,
<jiangguoqing@kylinos.cn>, <jpittman@redhat.com>,
<dave@stgolabs.net>, <wangkefeng.wang@huawei.com>,
<linux-block@vger.kernel.org>, <linux-ia64@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-acpi@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH 1/2] include/linux/nodemask.h: create node_available() helper
Date: Sat, 7 May 2022 16:47:42 +0800 [thread overview]
Message-ID: <68447b2a-31d7-4150-dbff-b06b0fd648a3@huawei.com> (raw)
In-Reply-To: <20220506172348.GA543299@bhelgaas>
[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]
On 2022/5/7 1:23, Bjorn Helgaas wrote:
> Subject line convention looks like "numa: ..."
>
> On Fri, May 06, 2022 at 01:58:00AM +0000, Peng Liu wrote:
>> Lots of code dose
> does
>
>> node != NUMA_NO_NODE && !node_online(node)
>> or
>> node == NUMA_NO_NODE || node_online(node)
>> so create node_available to do this to simplify code.
> node_available()
Thanks.
> I'm not really sure what meaning "node_available" conveys, though.
> Probably just because I don't understand NUMA.
>
> Should the test for NUMA_NO_NODE be folded into node_state() or
> node_online() directly instead of adding a new node_available()
> interface?
>
> NUMA_NO_NODE is -1. It's not clear to me that node_state()/
> node_isset()/test_bit() would do the right thing given -1. I doubt
> all node_online() callers ensure they don't pass NUMA_NO_NODE.
I have tested node_online(NUMA_NO_NODE) on x86_64, arm64, arm32, the results are:
arch node_online(NUMA_NO_NODE)
------------------------------------------
x86_64 0
arm64 1
arm32 0
.
Hence, I think the behavior of node_state(NUMA_NO_NODE) is undefined which is due to
test_bit(NUMA_NO_NODE) is different between different arches.
For many times, callers could ensure they don't pass NUMA_NO_NODE, for example "nid < 0" is
checked before node_online() or some code only used in NUMA has node. So, it is not
suitable to test NUMA_NO_NODE in node_state() or node_online().
Unfortunately, there are actually some cases that test for NUMA_NO_NODE is needed but ignored.
Related issue: ab31c7fd2d37 ("sched/numa: Fix boot crash on arm64 systems")
>> --- a/include/linux/nodemask.h
>> +++ b/include/linux/nodemask.h
>> @@ -70,6 +70,7 @@
>> *
>> * int node_online(node) Is some node online?
>> * int node_possible(node) Is some node possible?
>> + * int node_available(node) Is some node available(online or NUMA_NO_NODE)?
> Existing file generally fits in 80 columns; follow that lead unless
> you have a really good reason. E.g., maybe this?
>
> + * int node_available(node) Node online or NUMA_NO_NODE
> .
Thank you for your suggestion, I will send a revised patch with modified comments later.
[-- Attachment #2: Type: text/html, Size: 3230 bytes --]
next prev parent reply other threads:[~2022-05-07 8:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 1:57 [PATCH 0/2] null_blk: fix wrong use of nr_online_nodes Peng Liu
2022-05-06 1:58 ` [PATCH 1/2] include/linux/nodemask.h: create node_available() helper Peng Liu
2022-05-06 17:23 ` Bjorn Helgaas
2022-05-07 8:47 ` liupeng (DM) [this message]
2022-05-06 1:58 ` [PATCH 2/2] null_blk: fix wrong use of nr_online_nodes Peng Liu
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=68447b2a-31d7-4150-dbff-b06b0fd648a3@huawei.com \
--to=liupeng256@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dave@stgolabs.net \
--cc=guohanjun@huawei.com \
--cc=helgaas@kernel.org \
--cc=hpa@zytor.com \
--cc=jiangguoqing@kylinos.cn \
--cc=jpittman@redhat.com \
--cc=kch@nvidia.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=martin.oliveira@eideticom.com \
--cc=mcgrof@kernel.org \
--cc=ming.lei@redhat.com \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=thunder.leizhen@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).