Skip to contentSkip to conversation

mm/page_owner: record single timestamp value for high order allocations

PATCH Applied Hyeonggon Yoo 2 participants 2 messages Jan 21, 2023 – Feb 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_owner: record single timestamp value for high order allocations

When allocating a high-order page, separate allocation timestamp is recorded for each sub-page resulting in different timestamp values between them.

This behavior is not consistent with the behavior when recording free timestamp and caused confusion when analyzing memory dumps. Record single timestamp for the entire allocation, aligning with the behavior for free timestamps.

---
 mm/page_owner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_owner.c +2 -1
index f0553bedb39d..80dc8f4050fa 100644
@@ -163,6 +163,7 @@ static inline void __set_page_owner_handle(struct page_ext *page_ext,
 {
 	struct page_owner *page_owner;
 	int i;
+	u64 ts_nsec = local_clock();
 
 	for (i = 0; i < (1 << order); i++) {
 		page_owner = get_page_owner(page_ext);
@@ -172,7 +173,7 @@ static inline void __set_page_owner_handle(struct page_ext *page_ext,
 		page_owner->last_migrate_reason = -1;
 		page_owner->pid = current->pid;
 		page_owner->tgid = current->tgid;
-		page_owner->ts_nsec = local_clock();
+		page_owner->ts_nsec = ts_nsec;
 		strscpy(page_owner->comm, current->comm,
 			sizeof(page_owner->comm));
 		__set_bit(PAGE_EXT_OWNER, &page_ext->flags);
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Hyeonggon Yoo

When allocating a high-order page, separate allocation timestamp is recorded for each sub-page resulting in different timestamp values between them.

This behavior is not consistent with the behavior when recording free timestamp and caused confusion when analyzing memory dumps. Record single timestamp for the entire allocation, aligning with the behavior for free timestamps.

Quoted 25 lines
---
 mm/page_owner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_owner.c +2 -1
index f0553bedb39d..80dc8f4050fa 100644
@@ -163,6 +163,7 @@ static inline void __set_page_owner_handle(struct page_ext *page_ext,
 {
 	struct page_owner *page_owner;
 	int i;
+	u64 ts_nsec = local_clock();
 
 	for (i = 0; i < (1 << order); i++) {
 		page_owner = get_page_owner(page_ext);
@@ -172,7 +173,7 @@ static inline void __set_page_owner_handle(struct page_ext *page_ext,
 		page_owner->last_migrate_reason = -1;
 		page_owner->pid = current->pid;
 		page_owner->tgid = current->tgid;
-		page_owner->ts_nsec = local_clock();
+		page_owner->ts_nsec = ts_nsec;
 		strscpy(page_owner->comm, current->comm,
 			sizeof(page_owner->comm));
 		__set_bit(PAGE_EXT_OWNER, &page_ext->flags);