On Wed, Sep 13, 2023 at 11:51:25PM +0300, Mike Rapoport wrote: > > @@ -387,8 +390,12 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end, > > > > while (nr_pages--) { > > page = alloc_pages_node(nid, gfp_mask, 0); > > - if (!page) > > + if (!page) { > > goto out; > > + } else { > > + __mod_node_page_state(NODE_DATA(page_to_nid(page)), > > + NR_PAGE_METADATA, 1); > > We can update this once for nr_pages outside the loop, cannot we? Except that nr_pages is being used as the loop counter. Probably best to turn this into a normal (i = 0; i < nr_pages; i++) loop, and then we can do as you say. But this isn't a particularly interesting high-performance loop.