ksm: allocate roots when needed