Skip to contentSkip to conversation

powerpc/mm/hash: Free the subpage_prot_table correctly

PATCH Applied Aneesh Kumar K.V 4 participants 5 messages Jun 17, 2017 – Jul 27, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mm/hash: Free the subpage_prot_table correctly

Fixes dad6f37c2602e ("powerpc: subpage_protect: Increase the array size to take care of 64TB")
---
 arch/powerpc/mm/subpage-prot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/subpage-prot.c +1 -1
index e94fbd4c8845..781532d7bc4d 100644
@@ -36,7 +36,7 @@ void subpage_prot_free(struct mm_struct *mm)
 		}
 	}
 	addr = 0;
-	for (i = 0; i < 2; ++i) {
+	for (i = 0; i < (TASK_SIZE_USER64 >> 43); ++i) {
 		p = spt->protptrs[i];
 		if (!p)
 			continue;
Signature · 1 line
2.7.4
Tested-by on v1 1/1
#1 lore raw

This fix, resolved the OOM seen while running subpage_prot selftest, in a infinite loop.

Quoted 21 lines · Aneesh Kumar K.V
Fixes dad6f37c2602e ("powerpc: subpage_protect: Increase the array size to take care of 64TB")
---
 arch/powerpc/mm/subpage-prot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/subpage-prot.c +1 -1
index e94fbd4c8845..781532d7bc4d 100644
@@ -36,7 +36,7 @@ void subpage_prot_free(struct mm_struct *mm)
 		}
 	}
 	addr = 0;
-	for (i = 0; i < 2; ++i) {
+	for (i = 0; i < (TASK_SIZE_USER64 >> 43); ++i) {
 		p = spt->protptrs[i];
 		if (!p)
 			continue;
Signature · 1 line
2.7.4
Signature · 1 line
Ram Pai
#2 lore raw
Quoted 3 lines · Ram Pai

This fix, resolved the OOM seen while running subpage_prot selftest, in a infinite loop.

The OOM is caused because of memory leaks by wrong freeing of the subpage_prot_table previously ?

#3 lore raw

Re: [PATCH] powerpc/mm/hash: Free the subpage_prot_table correctlyy

Quoted 7 lines · Anshuman Khandual
Quoted 3 lines · Ram Pai

This fix, resolved the OOM seen while running subpage_prot selftest, in a infinite loop.

The OOM is caused because of memory leaks by wrong freeing of the subpage_prot_table previously ?

No. Rather, not freeing up of the memory allocated previously and tracked through the subpage_prot_table.

RP