> ptr = __alloc_bootmem_nopanic(total_size, max_align, 0);
Why duplicate the panic()? Just call __alloc_bootmem().
> #ifdef CONFIF_GENERIC_HARDIRQS
That doesn't appear to have been very well tested?
The code has a few coding-style glitches which checkpatch can detect.
--