David Hildenbrand
2021-Dec-09 11:52 UTC
[PATCH v1 2/2] virtio-mem: prepare fake page onlining code for granularity smaller than MAX_ORDER - 1
Hi Eric, thanks for the review!>> if (PageDirty(page)) { >> - virtio_mem_clear_fake_offline(pfn + i, max_nr_pages, >> - false); >> - generic_online_page(page, MAX_ORDER - 1); >> + virtio_mem_clear_fake_offline(pfn + i, 1 << order, false); >> + generic_online_page(page, order); >> } else { >> - virtio_mem_clear_fake_offline(pfn + i, max_nr_pages, >> - true); >> - free_contig_range(pfn + i, max_nr_pages); >> - adjust_managed_page_count(page, max_nr_pages); >> + virtio_mem_clear_fake_offline(pfn + i, 1 << order, true); >> + free_contig_range(pfn + i, 1 << order); >> + adjust_managed_page_count(page, 1 << order); > In the loop, pfn + i, 1 << order are repeatedly calculated. 1 << order > is a step size, pfn + i? is each step position. > Better to figure the numer once each iter?The compiler better be smart enough to calculate such constants once :)> > LGTL. > LGTM. > Reviewed-by: Eric Ren <renzhengeek at gmail.com>Thanks! -- Thanks, David / dhildenb