summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-09 15:02:59 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-09 15:02:59 +0200
commitffc843fc9c7a407474c5ebcd5dce63bcbfc0f7c0 (patch)
tree7505c296af3e6ef2a2f7a9ecc6edaa17024e71a0 /kernel/power
parentb21f18ef964b2c71aa0b451df6d17b7bcad8280d (diff)
parent7bf770f74e850c0b8d21ac143b3b2bc18813a6eb (diff)
Merge back earlier system-wide PM changes for v6.7.
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/snapshot.c16
-rw-r--r--kernel/power/swap.c4
2 files changed, 9 insertions, 11 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 0f12e0a97e43..50a15408c3fc 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -2545,8 +2545,9 @@ static void *get_highmem_page_buffer(struct page *page,
pbe->copy_page = tmp;
} else {
/* Copy of the page will be stored in normal memory */
- kaddr = safe_pages_list;
- safe_pages_list = safe_pages_list->next;
+ kaddr = __get_safe_page(ca->gfp_mask);
+ if (!kaddr)
+ return ERR_PTR(-ENOMEM);
pbe->copy_page = virt_to_page(kaddr);
}
pbe->next = highmem_pblist;
@@ -2750,8 +2751,9 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
return ERR_PTR(-ENOMEM);
}
pbe->orig_address = page_address(page);
- pbe->address = safe_pages_list;
- safe_pages_list = safe_pages_list->next;
+ pbe->address = __get_safe_page(ca->gfp_mask);
+ if (!pbe->address)
+ return ERR_PTR(-ENOMEM);
pbe->next = restore_pblist;
restore_pblist = pbe;
return pbe->address;
@@ -2783,8 +2785,6 @@ next:
if (handle->cur > 1 && handle->cur > nr_meta_pages + nr_copy_pages + nr_zero_pages)
return 0;
- handle->sync_read = 1;
-
if (!handle->cur) {
if (!buffer)
/* This makes the buffer be freed by swsusp_free() */
@@ -2827,7 +2827,6 @@ next:
memory_bm_position_reset(&zero_bm);
restore_pblist = NULL;
handle->buffer = get_buffer(&orig_bm, &ca);
- handle->sync_read = 0;
if (IS_ERR(handle->buffer))
return PTR_ERR(handle->buffer);
}
@@ -2837,9 +2836,8 @@ next:
handle->buffer = get_buffer(&orig_bm, &ca);
if (IS_ERR(handle->buffer))
return PTR_ERR(handle->buffer);
- if (handle->buffer != buffer)
- handle->sync_read = 0;
}
+ handle->sync_read = (handle->buffer == buffer);
handle->cur++;
/* Zero pages were not included in the image, memset it and move on. */
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 74edbce2320b..a64af0a552f9 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -1513,7 +1513,7 @@ end:
static void *swsusp_holder;
/**
- * swsusp_check - Check for swsusp signature in the resume device
+ * swsusp_check - Open the resume device and check for the swsusp signature.
* @exclusive: Open the resume device exclusively.
*/
@@ -1564,7 +1564,7 @@ put:
}
/**
- * swsusp_close - close swap device.
+ * swsusp_close - close resume device.
* @exclusive: Close the resume device which is exclusively opened.
*/