On Tue, 01 Aug 2023 23:55:38 -0600 Vishal Verma <vishal.l.verma@xxxxxxxxx> wrote: > Large amounts of memory managed by the kmem driver may come in via CXL, > and it is often desirable to have the memmap for this memory on the new > memory itself. > > Enroll kmem-managed memory for memmap_on_memory semantics as a default. > Add a sysfs override under the dax device to opt out of this behavior. > > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Cc: David Hildenbrand <david@xxxxxxxxxx> > Cc: Michal Hocko <mhocko@xxxxxxxx> > Cc: Oscar Salvador <osalvador@xxxxxxx> > Cc: Dan Williams <dan.j.williams@xxxxxxxxx> > Cc: Dave Jiang <dave.jiang@xxxxxxxxx> > Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> > Cc: Huang Ying <ying.huang@xxxxxxxxx> > Signed-off-by: Vishal Verma <vishal.l.verma@xxxxxxxxx> Hi Vishal, In general looks fine to me. Just a question for potential discussion if didn't miss it in earlier versions. FWIW Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Also, any docs need updating? Doesn't seem like the DAX ABI docs are present in Documentation/ABI so not sure where it should be updated. Jonathan > > @@ -1400,6 +1435,13 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) > dev_dax->align = dax_region->align; > ida_init(&dev_dax->ida); > > + /* > + * If supported by memory_hotplug, allow memmap_on_memory behavior by > + * default. This can be overridden via sysfs before handing the memory > + * over to kmem if desired. > + */ > + dev_dax->memmap_on_memory = true; If there are existing users, then this is a fairly significant change of defaults. Maybe it should be false and opt in rather than out? > + > inode = dax_inode(dax_dev); > dev->devt = inode->i_rdev; > dev->bus = &dax_bus_type;