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
692692 * chunk, as an optimization. It must, however, prioritize the faulting address
693693 * over all the others.
694694 */
695−typedef 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);
700695
701696 struct hmm_devmem {
702697 struct completion completion;
@@ -707,7 +702,6 @@ struct hmm_devmem { · 4 unmodified lines
707702 struct dev_pagemap pagemap;
708703 const struct hmm_devmem_ops *ops;
709704 struct percpu_ref ref;
710− dev_page_fault_t page_fault;
711705 };
712706
713707 /*
include/linux/memremap.h+6−0
@@ -80,6 +80,12 @@ struct dev_pagemap_ops { · 79 unmodified lines
8080 * Wait for refcount in struct dev_pagemap to be idle and reap it.
8181 */
8282 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);
8389 };
8490
8591 /**
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
129129 {
130130 return pfn_to_page(swp_offset(entry));
131131 }
132−
133−vm_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);
138132 #else /* CONFIG_DEVICE_PRIVATE */
139133 static inline swp_entry_t make_device_private_entry(struct page *page, bool write)
140134 {
@@ -164,15 +158,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) · 23 unmodified lines
164158 {
165159 return NULL;
166160 }
167−
168−static 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−}
176161 #endif /* CONFIG_DEVICE_PRIVATE */
177162
178163 #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