Message ID | 20190416134522.17540-15-ldufour@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Speculative page faults | expand |
On Tue, Apr 16, 2019 at 03:45:05PM +0200, Laurent Dufour wrote: > migrate_misplaced_page() is only called during the page fault handling so > it's better to pass the pointer to the struct vm_fault instead of the vma. > > This way during the speculative page fault path the saved vma->vm_flags > could be used. > > Acked-by: David Rientjes <rientjes@google.com> > Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> Reviewed-by: Jérôme Glisse <jglisse@redhat.com> > --- > include/linux/migrate.h | 4 ++-- > mm/memory.c | 2 +- > mm/migrate.c | 4 ++-- > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > index e13d9bf2f9a5..0197e40325f8 100644 > --- a/include/linux/migrate.h > +++ b/include/linux/migrate.h > @@ -125,14 +125,14 @@ static inline void __ClearPageMovable(struct page *page) > #ifdef CONFIG_NUMA_BALANCING > extern bool pmd_trans_migrating(pmd_t pmd); > extern int migrate_misplaced_page(struct page *page, > - struct vm_area_struct *vma, int node); > + struct vm_fault *vmf, int node); > #else > static inline bool pmd_trans_migrating(pmd_t pmd) > { > return false; > } > static inline int migrate_misplaced_page(struct page *page, > - struct vm_area_struct *vma, int node) > + struct vm_fault *vmf, int node) > { > return -EAGAIN; /* can't migrate now */ > } > diff --git a/mm/memory.c b/mm/memory.c > index d0de58464479..56802850e72c 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3747,7 +3747,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) > } > > /* Migrate to the requested node */ > - migrated = migrate_misplaced_page(page, vma, target_nid); > + migrated = migrate_misplaced_page(page, vmf, target_nid); > if (migrated) { > page_nid = target_nid; > flags |= TNF_MIGRATED; > diff --git a/mm/migrate.c b/mm/migrate.c > index a9138093a8e2..633bd9abac54 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1938,7 +1938,7 @@ bool pmd_trans_migrating(pmd_t pmd) > * node. Caller is expected to have an elevated reference count on > * the page that will be dropped by this function before returning. > */ > -int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, > +int migrate_misplaced_page(struct page *page, struct vm_fault *vmf, > int node) > { > pg_data_t *pgdat = NODE_DATA(node); > @@ -1951,7 +1951,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, > * with execute permissions as they are probably shared libraries. > */ > if (page_mapcount(page) != 1 && page_is_file_cache(page) && > - (vma->vm_flags & VM_EXEC)) > + (vmf->vma_flags & VM_EXEC)) > goto out; > > /* > -- > 2.21.0 >
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index e13d9bf2f9a5..0197e40325f8 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -125,14 +125,14 @@ static inline void __ClearPageMovable(struct page *page) #ifdef CONFIG_NUMA_BALANCING extern bool pmd_trans_migrating(pmd_t pmd); extern int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node); + struct vm_fault *vmf, int node); #else static inline bool pmd_trans_migrating(pmd_t pmd) { return false; } static inline int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node) + struct vm_fault *vmf, int node) { return -EAGAIN; /* can't migrate now */ } diff --git a/mm/memory.c b/mm/memory.c index d0de58464479..56802850e72c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3747,7 +3747,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) } /* Migrate to the requested node */ - migrated = migrate_misplaced_page(page, vma, target_nid); + migrated = migrate_misplaced_page(page, vmf, target_nid); if (migrated) { page_nid = target_nid; flags |= TNF_MIGRATED; diff --git a/mm/migrate.c b/mm/migrate.c index a9138093a8e2..633bd9abac54 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1938,7 +1938,7 @@ bool pmd_trans_migrating(pmd_t pmd) * node. Caller is expected to have an elevated reference count on * the page that will be dropped by this function before returning. */ -int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, +int migrate_misplaced_page(struct page *page, struct vm_fault *vmf, int node) { pg_data_t *pgdat = NODE_DATA(node); @@ -1951,7 +1951,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, * with execute permissions as they are probably shared libraries. */ if (page_mapcount(page) != 1 && page_is_file_cache(page) && - (vma->vm_flags & VM_EXEC)) + (vmf->vma_flags & VM_EXEC)) goto out; /*