[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y1h24tft.fsf@nvdebian.thelocal>
Date: Tue, 19 Sep 2023 15:31:29 +1000
From: Alistair Popple <apopple@...dia.com>
To: Huang Ying <ying.huang@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Bharata B Rao <bharata@....com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Wei Xu <weixugc@...gle.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Davidlohr Bueso <dave@...olabs.net>,
Johannes Weiner <hannes@...xchg.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Michal Hocko <mhocko@...nel.org>,
Yang Shi <shy828301@...il.com>,
Dave Jiang <dave.jiang@...el.com>,
Rafael J Wysocki <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH -V3 4/4] dax, kmem: calculate abstract distance with
general interface
Huang Ying <ying.huang@...el.com> writes:
> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> index fa1a8b418f9a..ca68ef17554b 100644
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -586,7 +586,7 @@ EXPORT_SYMBOL_GPL(init_node_memory_type);
> void clear_node_memory_type(int node, struct memory_dev_type *memtype)
> {
> mutex_lock(&memory_tier_lock);
> - if (node_memory_types[node].memtype == memtype)
> + if (node_memory_types[node].memtype == memtype || !memtype)
> node_memory_types[node].map_count--;
>
> /*
> * If we umapped all the attached devices to this node,
This implies it's possible memtype == NULL. Yet we have this:
* clear the node memory type.
*/
if (!node_memory_types[node].map_count) {
node_memory_types[node].memtype = NULL;
put_memory_type(memtype);
}
It's not safe to call put_memory_type(NULL), so what condition guarantees
map_count > 1 when called with memtype == NULL? Thanks.
- Alistair
Powered by blists - more mailing lists