> But the pages were already physically discontiguous before your change, > what's the difference ? Pages were not physically contiguous before my change. They were allocated with __vmalloc_node_range() which allocates sparse pages and maps them to a virtually contiguous span of memory within [VMALLOC_START, VMALLOC_END) range. > It doesn't matter that the pages are physically discontiguous as far as > they are virtually contiguous, which should still be the case here for a > stack. This patch is a preparation patch for the "dynamic kernel stack" feature, in the description it says: This is because with dynamic stacks we might have only partially populated stacks. We could compute the populated part of the stack, and determine its start and end mapped VA range by using vm_area->pages[] and vm_area->nr_pages, but that would make code a little uglier especially becuase we would need to take into the account if stack is growing up or down.. Therefore, using clear_page() is simpler and should be fast enough. Thanks, Pasha