Messages in this thread | | | Subject | Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier | From | David Hildenbrand <> | Date | Fri, 16 Oct 2020 10:57:35 +0200 |
| |
>> 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
| |