diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2019-07-18 08:19:24 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-07-22 11:19:26 -0400 |
commit | cfe61801b0f11eb561f1adf452d995efaafbc68b (patch) | |
tree | 2099664567934023ad7af6dcf2e7aa25ff03f8a7 | |
parent | dd422906799f240bfd400a5d376aa43f7b89c38a (diff) |
balloon: fix up comments
Lots of comments bitrotted. Fix them up.
Fixes: 418a3ab1e778 (mm/balloon_compaction: List interfaces)
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Acked-by: Nadav Amit <namit@vmware.com>
-rw-r--r-- | mm/balloon_compaction.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index d25664e1857b..798275a51887 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c | |||
@@ -32,8 +32,8 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info, | |||
32 | * @b_dev_info: balloon device descriptor where we will insert a new page to | 32 | * @b_dev_info: balloon device descriptor where we will insert a new page to |
33 | * @pages: pages to enqueue - allocated using balloon_page_alloc. | 33 | * @pages: pages to enqueue - allocated using balloon_page_alloc. |
34 | * | 34 | * |
35 | * Driver must call it to properly enqueue a balloon pages before definitively | 35 | * Driver must call this function to properly enqueue balloon pages before |
36 | * removing it from the guest system. | 36 | * definitively removing them from the guest system. |
37 | * | 37 | * |
38 | * Return: number of pages that were enqueued. | 38 | * Return: number of pages that were enqueued. |
39 | */ | 39 | */ |
@@ -63,12 +63,13 @@ EXPORT_SYMBOL_GPL(balloon_page_list_enqueue); | |||
63 | * @n_req_pages: number of requested pages. | 63 | * @n_req_pages: number of requested pages. |
64 | * | 64 | * |
65 | * Driver must call this function to properly de-allocate a previous enlisted | 65 | * Driver must call this function to properly de-allocate a previous enlisted |
66 | * balloon pages before definetively releasing it back to the guest system. | 66 | * balloon pages before definitively releasing it back to the guest system. |
67 | * This function tries to remove @n_req_pages from the ballooned pages and | 67 | * This function tries to remove @n_req_pages from the ballooned pages and |
68 | * return them to the caller in the @pages list. | 68 | * return them to the caller in the @pages list. |
69 | * | 69 | * |
70 | * Note that this function may fail to dequeue some pages temporarily empty due | 70 | * Note that this function may fail to dequeue some pages even if the balloon |
71 | * to compaction isolated pages. | 71 | * isn't empty - since the page list can be temporarily empty due to compaction |
72 | * of isolated pages. | ||
72 | * | 73 | * |
73 | * Return: number of pages that were added to the @pages list. | 74 | * Return: number of pages that were added to the @pages list. |
74 | */ | 75 | */ |
@@ -112,12 +113,13 @@ EXPORT_SYMBOL_GPL(balloon_page_list_dequeue); | |||
112 | 113 | ||
113 | /* | 114 | /* |
114 | * balloon_page_alloc - allocates a new page for insertion into the balloon | 115 | * balloon_page_alloc - allocates a new page for insertion into the balloon |
115 | * page list. | 116 | * page list. |
116 | * | 117 | * |
117 | * Driver must call it to properly allocate a new enlisted balloon page. | 118 | * Driver must call this function to properly allocate a new balloon page. |
118 | * Driver must call balloon_page_enqueue before definitively removing it from | 119 | * Driver must call balloon_page_enqueue before definitively removing the page |
119 | * the guest system. This function returns the page address for the recently | 120 | * from the guest system. |
120 | * allocated page or NULL in the case we fail to allocate a new page this turn. | 121 | * |
122 | * Return: struct page for the allocated page or NULL on allocation failure. | ||
121 | */ | 123 | */ |
122 | struct page *balloon_page_alloc(void) | 124 | struct page *balloon_page_alloc(void) |
123 | { | 125 | { |
@@ -130,19 +132,15 @@ EXPORT_SYMBOL_GPL(balloon_page_alloc); | |||
130 | /* | 132 | /* |
131 | * balloon_page_enqueue - inserts a new page into the balloon page list. | 133 | * balloon_page_enqueue - inserts a new page into the balloon page list. |
132 | * | 134 | * |
133 | * @b_dev_info: balloon device descriptor where we will insert a new page to | 135 | * @b_dev_info: balloon device descriptor where we will insert a new page |
134 | * @page: new page to enqueue - allocated using balloon_page_alloc. | 136 | * @page: new page to enqueue - allocated using balloon_page_alloc. |
135 | * | 137 | * |
136 | * Driver must call it to properly enqueue a new allocated balloon page | 138 | * Drivers must call this function to properly enqueue a new allocated balloon |
137 | * before definitively removing it from the guest system. | 139 | * page before definitively removing the page from the guest system. |
138 | * | 140 | * |
139 | * Drivers must not call balloon_page_enqueue on pages that have been | 141 | * Drivers must not call balloon_page_enqueue on pages that have been pushed to |
140 | * pushed to a list with balloon_page_push before removing them with | 142 | * a list with balloon_page_push before removing them with balloon_page_pop. To |
141 | * balloon_page_pop. To all pages on a list, use balloon_page_list_enqueue | 143 | * enqueue a list of pages, use balloon_page_list_enqueue instead. |
142 | * instead. | ||
143 | * | ||
144 | * This function returns the page address for the recently enqueued page or | ||
145 | * NULL in the case we fail to allocate a new page this turn. | ||
146 | */ | 144 | */ |
147 | void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, | 145 | void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, |
148 | struct page *page) | 146 | struct page *page) |
@@ -157,14 +155,23 @@ EXPORT_SYMBOL_GPL(balloon_page_enqueue); | |||
157 | 155 | ||
158 | /* | 156 | /* |
159 | * balloon_page_dequeue - removes a page from balloon's page list and returns | 157 | * balloon_page_dequeue - removes a page from balloon's page list and returns |
160 | * the its address to allow the driver release the page. | 158 | * its address to allow the driver to release the page. |
161 | * @b_dev_info: balloon device decriptor where we will grab a page from. | 159 | * @b_dev_info: balloon device decriptor where we will grab a page from. |
162 | * | 160 | * |
163 | * Driver must call it to properly de-allocate a previous enlisted balloon page | 161 | * Driver must call this function to properly dequeue a previously enqueued page |
164 | * before definetively releasing it back to the guest system. | 162 | * before definitively releasing it back to the guest system. |
165 | * This function returns the page address for the recently dequeued page or | 163 | * |
166 | * NULL in the case we find balloon's page list temporarily empty due to | 164 | * Caller must perform its own accounting to ensure that this |
167 | * compaction isolated pages. | 165 | * function is called only if some pages are actually enqueued. |
166 | * | ||
167 | * Note that this function may fail to dequeue some pages even if there are | ||
168 | * some enqueued pages - since the page list can be temporarily empty due to | ||
169 | * the compaction of isolated pages. | ||
170 | * | ||
171 | * TODO: remove the caller accounting requirements, and allow caller to wait | ||
172 | * until all pages can be dequeued. | ||
173 | * | ||
174 | * Return: struct page for the dequeued page, or NULL if no page was dequeued. | ||
168 | */ | 175 | */ |
169 | struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) | 176 | struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) |
170 | { | 177 | { |
@@ -177,9 +184,9 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) | |||
177 | if (n_pages != 1) { | 184 | if (n_pages != 1) { |
178 | /* | 185 | /* |
179 | * If we are unable to dequeue a balloon page because the page | 186 | * If we are unable to dequeue a balloon page because the page |
180 | * list is empty and there is no isolated pages, then something | 187 | * list is empty and there are no isolated pages, then something |
181 | * went out of track and some balloon pages are lost. | 188 | * went out of track and some balloon pages are lost. |
182 | * BUG() here, otherwise the balloon driver may get stuck into | 189 | * BUG() here, otherwise the balloon driver may get stuck in |
183 | * an infinite loop while attempting to release all its pages. | 190 | * an infinite loop while attempting to release all its pages. |
184 | */ | 191 | */ |
185 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); | 192 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); |
@@ -230,8 +237,8 @@ int balloon_page_migrate(struct address_space *mapping, | |||
230 | 237 | ||
231 | /* | 238 | /* |
232 | * We can not easily support the no copy case here so ignore it as it | 239 | * We can not easily support the no copy case here so ignore it as it |
233 | * is unlikely to be use with ballon pages. See include/linux/hmm.h for | 240 | * is unlikely to be used with balloon pages. See include/linux/hmm.h |
234 | * user of the MIGRATE_SYNC_NO_COPY mode. | 241 | * for a user of the MIGRATE_SYNC_NO_COPY mode. |
235 | */ | 242 | */ |
236 | if (mode == MIGRATE_SYNC_NO_COPY) | 243 | if (mode == MIGRATE_SYNC_NO_COPY) |
237 | return -EINVAL; | 244 | return -EINVAL; |