On Fri, 2023-11-03 at 09:43 -0700, fan wrote: > On Wed, Nov 01, 2023 at 04:51:52PM -0600, Vishal Verma wrote: > > [..] > > > > +static void __ref remove_memory_blocks_and_altmaps(u64 start, u64 size) > > +{ > > + unsigned long memblock_size = memory_block_size_bytes(); > > + u64 cur_start; > > + > > + /* > > + * For memmap_on_memory, the altmaps were added on a per-memblock > > + * basis; we have to process each individual memory block. > > + */ > > + for (cur_start = start; cur_start < start + size; > > + cur_start += memblock_size) { > > + struct vmem_altmap *altmap = NULL; > > + struct memory_block *mem; > > + > > + mem = find_memory_block(pfn_to_section_nr(PFN_DOWN(cur_start))); > > + WARN_ON_ONCE(!mem); > > + if (!mem) > > + continue; > > + > > + altmap = mem->altmap; > > + mem->altmap = NULL; > > + > > + remove_memory_block_devices(cur_start, memblock_size); > > Is cur_start always aligned to memory_block_size_bytes? If not, the > above function will return directly, is that a issue? > Hi Fan, Thanks for taking a look and the review (btw v9 is the latest revision of these). I think we're okay because the create side would've adding this memory in the first place as it too does an alignment check for memory_block_size_bytes. Thanks Vishal