On Fri, 2 Oct 2009, Christoph Lameter wrote: > > NODEMASK_ALLOC(x, m) assumes x is a type of struct, which is unnecessary. > > It's perfectly reasonable to use this macro to allocate a nodemask_t, > > which is anonymous, either dynamically or on the stack depending on > > NODES_SHIFT. > > There is currently only one user of NODEMASK_ALLOC which is > NODEMASK_SCRATCH. > That changes with Lee's patchset for mempolicy hugepage allocations and freeing, he'll be using it in generic hugetlb code. > Can we generalize the functionality here? The macro is basically choosing > between a slab allocation or a stack allocation depending on the > configured system size. > > NUMA_COND__ALLOC(<type>, <min numa nodes for not using stack>, > <variablename>) > > or so? > I assume we could, although it would be slightly messy because we'd be coding a stack allocation in a macro when comparing the passed value against CONFIG_NODES_SHIFT. > Its likely that one way want to allocate other structures on the stack > that may get too big if large systems need to be supported. > I don't think we currently have any examples of that other than nodemask_t. We allocate arrays of length MAX_NUMNODES quite often for things like node_to_cpumask_map, struct bootnode, etc, but no longer on the stack even in NUMA emulation. I'd be interested to see any non-nodemask use cases. -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html