diff mbox

powerpc/mm/hash: Free the subpage_prot_table correctly

Message ID 1497709855-25788-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Accepted
Commit 0da12a7a81f1e2255e89dc783c565e84801475a2
Headers show

Commit Message

Aneesh Kumar K.V June 17, 2017, 2:30 p.m. UTC
Fixes: dad6f37c2602e ("powerpc: subpage_protect: Increase the array size to take care of 64TB")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/mm/subpage-prot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ram Pai June 17, 2017, 4 p.m. UTC | #1
This fix, resolved the OOM seen while running subpage_prot selftest, in a
infinite loop.

Tested-by: Ram Pai <linuxram@us.ibm.com>


On Sat, Jun 17, 2017 at 08:00:55PM +0530, Aneesh Kumar K.V wrote:
> Fixes: dad6f37c2602e ("powerpc: subpage_protect: Increase the array size to take care of 64TB")
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  arch/powerpc/mm/subpage-prot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
> index e94fbd4c8845..781532d7bc4d 100644
> --- a/arch/powerpc/mm/subpage-prot.c
> +++ b/arch/powerpc/mm/subpage-prot.c
> @@ -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;
> -- 
> 2.7.4
Anshuman Khandual June 19, 2017, 7:22 a.m. UTC | #2
On 06/17/2017 09:30 PM, Ram Pai wrote:
> 
> 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 ?
Ram Pai June 19, 2017, 5:54 p.m. UTC | #3
On Mon, Jun 19, 2017 at 12:52:14PM +0530, Anshuman Khandual wrote:
> On 06/17/2017 09:30 PM, Ram Pai wrote:
> > 
> > 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
Michael Ellerman July 27, 2017, 12:38 p.m. UTC | #4
On Sat, 2017-06-17 at 14:30:55 UTC, "Aneesh Kumar K.V" wrote:
> Fixes: dad6f37c2602e ("powerpc: subpage_protect: Increase the array size to take care of 64TB")
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Tested-by: Ram Pai <linuxram@us.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/0da12a7a81f1e2255e89dc783c565e

cheers
diff mbox

Patch

diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index e94fbd4c8845..781532d7bc4d 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -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;