Hello Sudarshan, On 10/17/2020 07:32 AM, Sudarshan Rajagopalan wrote: > In the patch that enables memory hot-remove (commit bbd6ec605c0f ("arm64/mm: > Enable memory hot remove")) for arm64, there’s a notifier put in place that > prevents boot memory from being offlined and removed. The commit text > mentions that boot memory on arm64 cannot be removed. But x86 and other archs > doesn’t seem to do this prevention. > > The current logic is that only “new” memory blocks which are hot-added can > later be offlined and removed. The memory that system booted up with cannot > be offlined and removed. But there could be many usercases such as inter-VM > memory sharing where a primary VM could offline and hot-remove a > block/section of memory and lend it to secondary VM where it could hot-add > it. And after usecase is done, the reverse happens where secondary VM > hot-removes and gives it back to primary which can hot-add it back. In such > cases, the present logic for arm64 doesn’t allow this hot-remove in primary > to happen. > > Also, on systems with movable zone that sort of guarantees pages to be > migrated and isolated so that blocks can be offlined, this logic also defeats > the purpose of having a movable zone which system can rely on memory > hot-plugging, which say virt-io mem also relies on for fully plugged memory > blocks. > > This patch tries to solve by introducing a new section mem map sit > 'SECTION_MARK_HOTPLUGGABLE' which allows the concerned module drivers be able > to mark requried sections as "hotpluggable" by setting this bit. Also this > marking is only allowed for sections which are in movable zone and have > unmovable pages. The arm64 mmu code on receiving the MEM_GOING_OFFLINE > notification, we disallow offlining of any boot memory by checking if > section_early or not. With the introduction of SECTION_MARK_HOTPLUGGABLE, we > allow boot mem sections that are marked as hotpluggable with this bit set to > be offlined and removed. Thereby allowing required bootmem sections to be > offlinable.
This series was posted right after another thread you initiated in this regard but without even waiting for it to conclude in any manner. https://lore.kernel.org/linux-arm-kernel/de8388df2fbc5a6a33aab95831ba7...@codeaurora.org/ Inter-VM memory migration could be solved in other methods as David has mentioned. Boot memory cannot be removed and hence offlined on arm64 due to multiple reasons including making kexec non-functional afterwards. Besides these intrusive core MM changes are not really required. - Anshuman