[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734za6869.fsf@nvdebian.thelocal>
Date: Tue, 19 Sep 2023 15:14:10 +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 3/4] acpi, hmat: calculate abstract distance with HMAT
Thanks for making changes here, looks better to me at least.
Huang Ying <ying.huang@...el.com> writes:
> static __init void hmat_free_structures(void)
> {
> struct memory_target *target, *tnext;
> @@ -801,6 +857,7 @@ static __init int hmat_init(void)
> struct acpi_table_header *tbl;
> enum acpi_hmat_type i;
> acpi_status status;
> + int usage;
>
> if (srat_disabled() || hmat_disable)
> return 0;
> @@ -841,7 +898,10 @@ static __init int hmat_init(void)
> hmat_register_targets();
>
> /* Keep the table and structures if the notifier may use them */
> - if (!hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
> + usage = !hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI);
> + if (!hmat_set_default_dram_perf())
> + usage += !register_mt_adistance_algorithm(&hmat_adist_nb);
> + if (usage)
> return 0;
Can we simplify the error handling here? As I understand it
hotplug_memory_notifier() and register_mt_adistance_algorithm() aren't
expected to ever fail because hmat_init() should only be called once and
the notifier register shouldn't fail. So wouldn't the below be
effectively the same thing but clearer?
if (hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
goto out_put;
if (!hmat_set_default_dram_perf())
register_mt_adistance_algorithm(&hmat_adist_nb);
return 0;
> out_put:
> hmat_free_structures();
Also as an aside while looking at this patch I noticed a minor bug:
status = acpi_get_table(ACPI_SIG_HMAT, 0, &tbl);
if (ACPI_FAILURE(status))
goto out_put;
This will call acpi_put_table(tbl) even though we failed to get the
table.
Powered by blists - more mailing lists