in mm/mmu_context.c [58:78]
static mm_context_t get_new_context(void)
{
/* Return the next pid */
next_mmu_context += (1UL << PID_SHIFT);
/* If the pid field wraps around we increase the version and
* flush the tlb */
if (unlikely(CTX_PID(next_mmu_context) == 0)) {
/* Version is incremented since the pid increment above
* overflows info version */
flush_cache_all();
flush_tlb_all();
}
/* If the version wraps we start over with the first generation, we do
* not need to flush the tlb here since it's always done above */
if (unlikely(CTX_VERSION(next_mmu_context) == 0))
next_mmu_context = FIRST_CTX;
return next_mmu_context;
}