There can't be any difference between two pgd_none(*pgd) at L162 and L167,so it's always false at L171.

Dave Hansen explained:

Yes, the double-test was part of an optimization where we attempted to avoid using a global spinlock in the fork() path. We would check for unallocated mid-level page tables without the lock. The lock was only taken when we needed to *make* an entry to avoid collisions.

Now that it is all single-threaded, there is no chance of a collision, no need for a lock, and no need for the re-check.

As all these functions are only called during init, mark them __init aswell.