Skip to content

Commit

Permalink
mm/migrate: fix migrate_pgmap_owner w/o CONFIG_MMU_NOTIFIER
Browse files Browse the repository at this point in the history
On x86_64, when CONFIG_MMU_NOTIFIER is not set/enabled, there is a
compiler error:

   mm/migrate.c: In function 'migrate_vma_collect':
   mm/migrate.c:2481:7: error: 'struct mmu_notifier_range' has no member named 'migrate_pgmap_owner'
     range.migrate_pgmap_owner = migrate->pgmap_owner;
          ^

Fixes: 998427b ("mm/notifier: add migration invalidation type")
Reported-by: Randy Dunlap <[email protected]>
Signed-off-by: Ralph Campbell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Tested-by: Randy Dunlap <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
Cc: Jerome Glisse <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: "Jason Gunthorpe" <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ralph Campbell authored and torvalds committed Aug 7, 2020
1 parent d6efb3a commit c1a06df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions include/linux/mmu_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,16 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
range->flags = flags;
}

static inline void mmu_notifier_range_init_migrate(
struct mmu_notifier_range *range, unsigned int flags,
struct vm_area_struct *vma, struct mm_struct *mm,
unsigned long start, unsigned long end, void *pgmap)
{
mmu_notifier_range_init(range, MMU_NOTIFY_MIGRATE, flags, vma, mm,
start, end);
range->migrate_pgmap_owner = pgmap;
}

#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
({ \
int __young; \
Expand Down Expand Up @@ -645,6 +655,9 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range,

#define mmu_notifier_range_init(range,event,flags,vma,mm,start,end) \
_mmu_notifier_range_init(range, start, end)
#define mmu_notifier_range_init_migrate(range, flags, vma, mm, start, end, \
pgmap) \
_mmu_notifier_range_init(range, start, end)

static inline bool
mmu_notifier_range_blockable(const struct mmu_notifier_range *range)
Expand Down
6 changes: 3 additions & 3 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,9 +2386,9 @@ static void migrate_vma_collect(struct migrate_vma *migrate)
* that the registered device driver can skip invalidating device
* private page mappings that won't be migrated.
*/
mmu_notifier_range_init(&range, MMU_NOTIFY_MIGRATE, 0, migrate->vma,
migrate->vma->vm_mm, migrate->start, migrate->end);
range.migrate_pgmap_owner = migrate->pgmap_owner;
mmu_notifier_range_init_migrate(&range, 0, migrate->vma,
migrate->vma->vm_mm, migrate->start, migrate->end,
migrate->pgmap_owner);
mmu_notifier_invalidate_range_start(&range);

walk_page_range(migrate->vma->vm_mm, migrate->start, migrate->end,
Expand Down

0 comments on commit c1a06df

Please sign in to comment.