On Fri 24-07-20 21:56:29, Muchun Song wrote: > On Fri, Jul 24, 2020 at 7:34 PM Michal Hocko <mhocko@xxxxxxxxxx> wrote: [...] > > I believe you can simplify this and use a similar pattern as the page > > allocator. Something like > > > > for_each_node_mask(node, mpol_allowed) { > > if (node_isset(node, &cpuset_current_mems_allowed)) > > nr += array[node]; > > } > > > > There shouldn't be any need to allocate a potentially large nodemask on > > the stack. > > An unsigned long can satisfy 64 nodes. So I think that nodemask is using > little stack memory. Right? CONFIG_NODES_SHIFT=10 is not something surprising. E.g. SLES is using that default for a long time because those kernels tend to run on very large machines. -- Michal Hocko SUSE Labs