History

memremap: add a migrate_to_ram method to struct dev_pagemap_ops

This replaces the hacky ->fault callback, which is currently directly called from common code through a hmm specific data structure as an exercise in layering violations.

Christoph Hellwig committed 7 years ago

Commit 897e6361 parent f6a55e16 files · +17 −67Browse files

Showing the changes to include/linux (3 of 6 files). Show all

Unified · Split

3 files
  1. include/linux/hmm.h +0 −6
  2. include/linux/memremap.h +6 −0
  3. include/linux/swapops.h +0 −15
include/linux/hmm.h+0−6
@@ -692,11 +692,6 @@ struct hmm_devmem_ops { · 691 unmodified lines
692 * chunk, as an optimization. It must, however, prioritize the faulting address692 * chunk, as an optimization. It must, however, prioritize the faulting address
693 * over all the others.693 * over all the others.
694 */694 */
695typedef vm_fault_t (*dev_page_fault_t)(struct vm_area_struct *vma,
696 unsigned long addr,
697 const struct page *page,
698 unsigned int flags,
699 pmd_t *pmdp);
700 695
701struct hmm_devmem {696struct hmm_devmem {
702 struct completion completion;697 struct completion completion;
@@ -707,7 +702,6 @@ struct hmm_devmem { · 4 unmodified lines
707 struct dev_pagemap pagemap;702 struct dev_pagemap pagemap;
708 const struct hmm_devmem_ops *ops;703 const struct hmm_devmem_ops *ops;
709 struct percpu_ref ref;704 struct percpu_ref ref;
710 dev_page_fault_t page_fault;
711};705};
712 706
713/*707/*
include/linux/memremap.h+6−0
@@ -80,6 +80,12 @@ struct dev_pagemap_ops { · 79 unmodified lines
80 * Wait for refcount in struct dev_pagemap to be idle and reap it.80 * Wait for refcount in struct dev_pagemap to be idle and reap it.
81 */81 */
82 void (*cleanup)(struct dev_pagemap *pgmap);82 void (*cleanup)(struct dev_pagemap *pgmap);
83
84 /*
85 * Used for private (un-addressable) device memory only. Must migrate
86 * the page back to a CPU accessible page.
87 */
88 vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf);
83};89};
84 90
85/**91/**
include/linux/swapops.h+0−15
@@ -129,12 +129,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) · 128 unmodified lines
129{129{
130 return pfn_to_page(swp_offset(entry));130 return pfn_to_page(swp_offset(entry));
131}131}
132
133vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
134 unsigned long addr,
135 swp_entry_t entry,
136 unsigned int flags,
137 pmd_t *pmdp);
138#else /* CONFIG_DEVICE_PRIVATE */132#else /* CONFIG_DEVICE_PRIVATE */
139static inline swp_entry_t make_device_private_entry(struct page *page, bool write)133static inline swp_entry_t make_device_private_entry(struct page *page, bool write)
140{134{
@@ -164,15 +158,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) · 23 unmodified lines
164{158{
165 return NULL;159 return NULL;
166}160}
167
168static inline vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
169 unsigned long addr,
170 swp_entry_t entry,
171 unsigned int flags,
172 pmd_t *pmdp)
173{
174 return VM_FAULT_SIGBUS;
175}
176#endif /* CONFIG_DEVICE_PRIVATE */161#endif /* CONFIG_DEVICE_PRIVATE */
177 162
178#ifdef CONFIG_MIGRATION163#ifdef CONFIG_MIGRATION

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t