lkml.org 
[lkml]   [2020]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier
From
Date
>> 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

\
 
 \ /
  Last update: 2020-10-16 10:58    [W:0.155 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site