[PATCH v2 08/16] mm: add ability to take further action in vm_area_desc
Lorenzo Stoakes
lorenzo.stoakes at oracle.com
Fri Sep 12 03:18:44 PDT 2025
On Thu, Sep 11, 2025 at 03:07:21PM -0700, Reinette Chatre wrote:
> Hi Lorenzo,
>
> On 9/10/25 1:22 PM, Lorenzo Stoakes wrote:
>
> ...
>
> > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > index 4a441f78340d..ae6c7a0a18a7 100644
> > --- a/include/linux/mm_types.h
> > +++ b/include/linux/mm_types.h
> > @@ -770,6 +770,64 @@ struct pfnmap_track_ctx {
> > };
> > #endif
> >
> > +/* What action should be taken after an .mmap_prepare call is complete? */
> > +enum mmap_action_type {
> > + MMAP_NOTHING, /* Mapping is complete, no further action. */
> > + MMAP_REMAP_PFN, /* Remap PFN range based on desc->remap. */
> > + MMAP_INSERT_MIXED, /* Mixed map based on desc->mixedmap. */
> > + MMAP_INSERT_MIXED_PAGES, /* Mixed map based on desc->mixedmap_pages. */
> > + MMAP_CUSTOM_ACTION, /* User-provided hook. */
> > +};
> > +
> > +struct mmap_action {
> > + union {
> > + /* Remap range. */
> > + struct {
> > + unsigned long addr;
> > + unsigned long pfn;
> > + unsigned long size;
> > + pgprot_t pgprot;
> > + } remap;
> > + /* Insert mixed map. */
> > + struct {
> > + unsigned long addr;
> > + unsigned long pfn;
> > + unsigned long num_pages;
> > + } mixedmap;
> > + /* Insert specific mixed map pages. */
> > + struct {
> > + unsigned long addr;
> > + struct page **pages;
> > + unsigned long num_pages;
> > + /* kfree pages on completion? */
> > + bool kfree_pages :1;
> > + } mixedmap_pages;
> > + struct {
> > + int (*action_hook)(struct vm_area_struct *vma);
> > + } custom;
> > + };
> > + enum mmap_action_type type;
> > +
> > + /*
> > + * If specified, this hook is invoked after the selected action has been
> > + * successfully completed. Not that the VMA write lock still held.
>
> A typo that may trip tired eyes: Not -> Note ? (perhaps also "is still held"?)
> (also in the duplicate changes to tools/testing/vma/vma_internal.h)
Yeah good catch! Will fix if respin :)
Cheers, Lorenzo
More information about the kexec
mailing list