kernel: calculate size