[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17ca9bd8-bdc6-541c-b8f9-4076cb9a7322@redhat.com>
Date: Fri, 16 Oct 2020 10:57:35 +0200
From: David Hildenbrand <david@...hat.com>
To: Wei Yang <richard.weiyang@...ux.alibaba.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
virtualization@...ts.linux-foundation.org,
Andrew Morton <akpm@...ux-foundation.org>,
"Michael S . Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Pankaj Gupta <pankaj.gupta.linux@...il.com>
Subject: Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline
pages in memory notifier
>> Do we adjust the count twice?
>>
>
> Ah, I got the reason why we need to adjust count for *unplugged* sub-blocks.
Exactly.
>
>>> - for (i = 0; i < nr_pages; i++) {
>>> - page = pfn_to_page(pfn + i);
>>> - if (WARN_ON(!page_ref_dec_and_test(page)))
>
> Another question is when we grab a refcount for the unpluged pages? The one
> you mentioned in virtio_mem_set_fake_offline().
Yeah, that was confusing on my side. I actually meant
virtio_mem_fake_offline() - patch #12.
We have a reference on unplugged (fake offline) blocks via
1. memmap initialization, if never online via generic_online_page()
So if we keep pages fake offline when onlining memory, they
a) Have a refcount of 1
b) Have *not* increased the managed page count
2. alloc_contig_range(), if fake offlined. After we fake-offlined pages
(e.g., patch #12), such pages
a) Have a refcount of 1
b) Have *not* increased the managed page count (because we manually
decreased it)
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists