On 01.08.19 10:39, Oscar Salvador wrote: > On Thu, Aug 01, 2019 at 10:17:23AM +0200, David Hildenbrand wrote: >> I am not yet sure about two things: >> >> >> 1. Checking uninitialized pages for PageVmemmap() when onlining. I >> consider this very bad. >> >> I wonder if it would be better to remember for each memory block the pfn >> offset, which will be used when onlining/offlining. >> >> I have some patches that convert online_pages() to >> __online_memory_block(struct memory block *mem) - which fits perfect to >> the current user. So taking the offset and processing only these pages >> when onlining would be easy. To do the same for offline_pages(), we >> first have to rework memtrace code. But when offlining, all memmaps have >> already been initialized. > > This is true, I did not really like that either, but was one of the things > I came up. > I already have some ideas how to avoid checking the page, I will work on it. I think it would be best if we find some way that during onlining/offlining we skip the vmemmap part completely. (e.g., as discussed via an offset in the memblock or similar) > >> 2. Setting the Vmemmap pages to the zone of the online type. This would >> mean we would have unmovable data on pages marked to belong to the >> movable zone. I would suggest to always set them to the NORMAL zone when >> onlining - and inititalize the vmemmap of the vmemmap pages directly >> during add_memory() instead. > > IMHO, having vmemmap pages in ZONE_MOVABLE do not matter that match. > They are not counted as managed_pages, and they are not show-stopper for > moving all the other data around (migrate), they are just skipped. > Conceptually, they are not pages we can deal with. I am not sure yet about the implications of having these belong to a zone they don't hmmmm. Will the pages be PG_reserved? > > I thought they should lay wherever the range lays. > Having said that, I do not oppose to place them in ZONE_NORMAL, as they might > fit there better under the theory that ZONE_NORMAL have memory that might not be > movable/migratable. > > As for initializing them in add_memory(), we cannot do that. > First problem is that we first need sparse_mem_map_populate to create > the mapping, and to take the pages from our altmap. > > Then, we can access and initialize those pages. > So we cannot do that in add_memory() because that happens before. > > And I really think that it fits much better in __add_pages than in add_memory. Sorry, I rather meant when adding memory, not when onlining. But you seem to do that already. :) > > Given said that, I would appreciate some comments in patches#3 and patches#4, > specially patch#4. Will have a look! > So I would like to collect some feedback in those before sending a new version. > > Thanks David > -- Thanks, David / dhildenb