On 2026-10-29 18:42 -0700, Alison Schofield wrote:
> On Wed, Oct 28, 2026 at 02:21:23PM -0700, Gregory Price (Meta) wrote:
> > daxctl_memory_online_with_zone() is meant to scan the device's blocks
> > after onlining them and fail with -EBUSY if any block is not in the
> > requested zone: an agent such as an auto-online policy or a udev rule
> > may have onlined some blocks first, into a zone daxctl did not ask for.
> > online_one_memblock() relies on that scan, it ignores a failed write
> > for a block that someone else onlined ("There will be a full scan for
> > zone correctness later").
> > 
> > But daxctl_memory_op() returns the number of blocks it onlined, and the
> > function returns early on any non-zero value, so the scan only ever
> > runs when no block was onlined at all.  Whenever daxctl does online
> > memory, a zone mismatch goes unreported.
> > 
> > Example: 
> >   memory_hotplug.online_policy=auto-movable
> >   reconfigure-device --no-movable -m system-ram
> > 
> >   => reports success with the memory in ZONE_MOVABLE.
> 
> Hi Gregory,
> 
> Does writing "online" let the kernels auto-movable policy select
> ZONE_MOVABLE? I'm wondering if this is a race, or if daxctl should
> be using "online_kernel" for --no-movable.
> 

'online' basically means "kernel picks".  I think it's reasonable to
convert to using 'online_kernel' for --no-movable.

> > @@ -1704,8 +1704,9 @@ static int daxctl_memory_online_with_zone(struct 
> > daxctl_memory *mem,
> >             err(ctx, "%s: BUG: invalid zone for onlining\n", devname);
> >             rc = -EINVAL;
> >     }
> > -   if (rc)
> > +   if (rc < 0)
> >             return rc;
> 
> What happens if the kernel places memory in ZONE_DMA32?
> Will that lead to a MEM_ZONE_UNKNOWN and then an -EBUSY?
> 

Hm, let me dig into this a little bit.  I didn't think this could happen
for dax hotplug - but it is subject to default_kernel_zone_for_pfn.

Give me a bit

-- 
~Gregory


Reply via email to