[PATCH v3 3/5] mm/memory-failure: efi: record hardware-poisoned frames into the poisoned-memory table

Breno Leitao leitao at debian.org
Mon Sep 7 08:23:46 PDT 2026


On Fri, Aug 28, 2026 at 03:11:10PM +0100, Kiryl Shutsemau wrote:
> On Wed, Aug 26, 2026 at 05:03:54AM -0700, Breno Leitao wrote:
> > +#include <linux/memblock.h>
> 
> Is it leftover? I don't see any memblock usage.

Yes, good catch, I will remove.
> > +#include <linux/mm.h>
> > +#include <linux/overflow.h>
> > +
> > +static struct linux_efi_poisoned_memory *efi_poison __ro_after_init;
> > +static u64 efi_poison_nbits __ro_after_init;
> > +
> > +static u64 __init
> > +efi_poison_usable_size(const struct linux_efi_poisoned_memory *pm)
> > +{
> > +	u64 nr_units = DIV_ROUND_UP(PFN_PHYS(max_pfn), pm->unit_size);
> > +	u64 bytes = DIV_ROUND_UP(nr_units, BITS_PER_BYTE);
> > +
> > +	/* Whole words: the bitmap is reached an unsigned long at a time. */
> > +	return min(round_up(bytes, sizeof(unsigned long)), pm->size);
> 
> Hm. Why bother to clamp to max_pfn? What's what's wrong with just using
> pm->size directly?

The clamp is a min(), so it can only ever make the kernel use less of
the table than the table claims, just a silly and cheap optimization.

That said, pm->size is more than enought for now, and we optimize later.

I will drop efi_poison_usable_size() completely and replace it by
pm->size.

Thanks,
--breno



More information about the kexec mailing list