[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e46b1c5-f52b-0155-4d4f-e3bbdea95384@redhat.com>
Date: Tue, 12 Nov 2019 12:12:33 +0100
From: David Hildenbrand <david@...hat.com>
To: Michael Ellerman <mpe@...erman.id.au>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, linuxppc-dev@...ts.ozlabs.org,
Andrew Morton <akpm@...ux-foundation.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Thiago Jung Bauermann <bauerman@...ux.ibm.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Anshuman Khandual <khandual@...ux.vnet.ibm.com>,
Oliver O'Halloran <oohall@...il.com>,
Alexey Kardashevskiy <aik@...abs.ru>,
"Enrico Weigelt, metux IT consult" <info@...ux.net>,
Thomas Gleixner <tglx@...utronix.de>,
Allison Randal <allison@...utok.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Pavel Tatashin <pasha.tatashin@...een.com>,
Arun KS <arunks@...eaurora.org>, Todd Kjos <tkjos@...gle.com>,
Christian Brauner <christian@...uner.io>,
Gao Xiang <xiang@...nel.org>,
Greg Hackmann <ghackmann@...gle.com>,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH v1 08/12] powerpc/pseries: CMM: Implement balloon
compaction
On 12.11.19 11:46, Michael Ellerman wrote:
> David Hildenbrand <david@...hat.com> writes:
>> On 31.10.19 15:29, David Hildenbrand wrote:
>>> We can now get rid of the cmm_lock and completely rely on the balloon
>>> compaction internals, which now also manage the page list and the lock.
> ...
>>> +
>>> +static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
>>> + struct page *newpage, struct page *page,
>>> + enum migrate_mode mode)
>>> +{
>>> + unsigned long flags;
>>> +
>>> + /*
>>> + * loan/"inflate" the newpage first.
>>> + *
>>> + * We might race against the cmm_thread who might discover after our
>>> + * loan request that another page is to be unloaned. However, once
>>> + * the cmm_thread runs again later, this error will automatically
>>> + * be corrected.
>>> + */
>>> + if (plpar_page_set_loaned(newpage)) {
>>> + /* Unlikely, but possible. Tell the caller not to retry now. */
>>> + pr_err_ratelimited("%s: Cannot set page to loaned.", __func__);
>>> + return -EBUSY;
>>> + }
>>> +
>>> + /* balloon page list reference */
>>> + get_page(newpage);
>>> +
>>> + spin_lock_irqsave(&b_dev_info->pages_lock, flags);
>>> + balloon_page_insert(b_dev_info, newpage);
>>> + balloon_page_delete(page);
>>
>> I think I am missing a b_dev_info->isolated_pages-- here.
>
> I don't know this code at all, but looking at other balloon drivers they
> do seem to do that in roughly the same spot.
>
> I'll add it, how can we test that it's correct?
It's certainly correct. We increment when we isolate
(balloon_page_isolate()) and decrement when we un-isolate.
Un-isolate happens when we putback a isolated page
(balloon_page_putback() - migration aborted) or when we successfully
migrate it (via balloon_page_migrate()).
The issue is that we cannot decrement in balloon_page_migrate(), as we
have to hold the b_dev_info->pages_lock. That's why we have to do it in
the registered callback under lock.
Please note that b_dev_info->isolated_pages is only needed for a sanity
check in balloon_page_dequeue(). That's why I didn't notice during
testing. I wonder if we should at some point rip out that sanity check ...
Thanks and cheers!
>
> cheers
>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists