[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hu9_TA0KAe=9ZCSG4_KijSYb=qnt8MYe9QYwGbz=pmBg@mail.gmail.com>
Date: Mon, 22 Jun 2020 17:27:53 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Dan Williams <dan.j.williams@...el.com>,
Erik Kaneda <erik.kaneda@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>, Borislav Petkov <bp@...en8.de>,
Ira Weiny <ira.weiny@...el.com>,
James Morse <james.morse@....com>,
Myron Stowe <myron.stowe@...hat.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
Bob Moore <robert.moore@...el.com>
Subject: Re: [RFT][PATCH v2 2/4] ACPI: OSL: Add support for deferred unmapping
of ACPI memory
On Mon, Jun 22, 2020 at 4:56 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Mon, Jun 22, 2020 at 5:06 PM Rafael J. Wysocki <rjw@...ysocki.net> wrote:
> >
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
> >
> > Implement acpi_os_unmap_deferred() and
> > acpi_os_release_unused_mappings() and set ACPI_USE_DEFERRED_UNMAPPING
> > to allow ACPICA to use deferred unmapping of memory in
> > acpi_ex_system_memory_space_handler() so as to avoid RCU-related
> > performance issues with memory opregions.
>
> ...
>
> > +static bool acpi_os_drop_map_ref(struct acpi_ioremap *map, bool defer)
> > {
> > - unsigned long refcount = --map->refcount;
> > + if (--map->track.refcount)
> > + return true;
> >
> > - if (!refcount)
> > - list_del_rcu(&map->list);
> > - return refcount;
> > + list_del_rcu(&map->list);
> > +
>
> > + if (defer) {
> > + INIT_LIST_HEAD(&map->track.gc);
> > + list_add_tail(&map->track.gc, &unused_mappings);
>
> > + return true;
> > + }
> > +
> > + return false;
>
> A nit:
>
> Effectively it returns a value of defer.
>
> return defer;
>
> > }
Do you mean that one line of code could be saved? Yes, it could.
>
> ...
>
> > @@ -416,26 +421,102 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
> > }
> >
> > mutex_lock(&acpi_ioremap_lock);
> > +
> > map = acpi_map_lookup_virt(virt, size);
>
> A nit: should it be somewhere else (I mean in another patch)?
Do you mean the extra empty line?
No, I don't think so, or the code style after this patch would not
look consistent.
> > if (!map) {
>
> ...
>
> > + /* Release the unused mappings in the list. */
> > + while (!list_empty(&list)) {
> > + struct acpi_ioremap *map;
> > +
> > + map = list_entry(list.next, struct acpi_ioremap, track.gc);
>
> A nt: if __acpi_os_map_cleanup() (actually acpi_unmap() according to
> the code) has no side effects, can we use list_for_each_entry_safe()
> here?
I actually prefer a do .. while version of this which saves the
initial check (which has been carried out already).
> > + list_del(&map->track.gc);
> > + __acpi_os_map_cleanup(map);
> > + }
> > +}
>
> ...
>
> > @@ -472,16 +552,18 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
> > return;
> >
> > mutex_lock(&acpi_ioremap_lock);
> > +
> > map = acpi_map_lookup(addr, gas->bit_width / 8);
>
> A nit: should it be somewhere else (I mean in another patch)?
Nope.
Thanks!
Powered by blists - more mailing lists