Messages in this thread | | | Date | Tue, 7 Aug 2018 22:48:34 +0200 | From | Oscar Salvador <> | Subject | Re: [RFC PATCH 2/3] mm/memory_hotplug: Create __shrink_pages and move it to offline_pages |
| |
On Tue, Aug 07, 2018 at 04:54:57PM +0200, David Hildenbrand wrote: > I wonder if we could instead forward from the callers whether we are > dealing with ZONE_DEVICE memory (is_device ...), at least that seems > feasible in hmm code. Not having looked at details yet.
Yes, this looks like the most straightforward way right now. We would have to pass it from arch_remove_memory to __remove_pages though.
It is not the most elegant way, but looking at the code of devm_memremap_pages_release and hmm_devmem_release I cannot really think of anything better.
In hmm_devmem_release is should be easy because AFAIK (unless I am missing something), hmm always works with ZONE_DEVICE. At least hmm_devmem_pages_create() moves the range to ZONE_DEVICE.
After looking at devm_memremap_pages(), I think it does the same:
... move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE], align_start >> PAGE_SHIFT, align_size >> PAGE_SHIFT, altmap); ...
So I guess it is safe to assume that arch_remove_memory/__remove_pages are called from those functions while zone being ZONE_DEVICE.
Is that right, Jerome?
And since we know for sure that memhotplug-code cannot call it with ZONE_DEVICE, I think this can be done easily.
Thanks -- Oscar Salvador SUSE L3
| |