Messages in this thread | | | From | "Aneesh Kumar K.V" <> | Subject | Re: [PATCH v2 05/10] mm, hugetlb: fix and clean-up node iteration code to alloc or free | Date | Tue, 23 Jul 2013 06:35:15 +0530 |
| |
Michal Hocko <mhocko@suse.cz> writes:
> On Mon 22-07-13 17:36:26, Joonsoo Kim wrote: >> Current node iteration code have a minor problem which do one more >> node rotation if we can't succeed to allocate. For example, >> if we start to allocate at node 0, we stop to iterate at node 0. >> Then we start to allocate at node 1 for next allocation. >> >> I introduce new macros "for_each_node_mask_to_[alloc|free]" and >> fix and clean-up node iteration code to alloc or free. >> This makes code more understandable. > > I don't know but it feels like you are trying to fix an awkward > interface with another one. Why hstate_next_node_to_alloc cannot simply > return MAX_NUMNODES once the loop is done and start from first_node next > time it is called? We wouldn't have the bug you are mentioning and you > do not need scary looking macros. >
Even though the macros looks confusing, the changes do help rest of the code. for ex: I liked how it made alloc simpler.
+ for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { + page = alloc_fresh_huge_page_node(h, node);
-aneesh
| |