[PATCH] free_one_pgd

From: NIIBE Yutaka (gniibe@m17n.org)
Date: Mon Jul 16 2001 - 03:26:50 EST


Recently, in my arch (SuperH which uses two-level page table), I've
changed the function pgd_clear to zero-clear the entry. Then, we see
memory leak.

I think that pgd_clear in free_one_pgd should be placed _after_
calling free_one_pmd. Or else, free_one_pmd doesn't free anything.

This memory leak occurs when the architecture uses two-level page table
and non-null implementation of pgd_clear.

Index: mm/memory.c
===================================================================
RCS file: /cvsroot/linuxsh/kernel/mm/memory.c,v
retrieving revision 1.31
diff -u -p -r1.31 memory.c
--- mm/memory.c 2001/07/11 01:12:27 1.31
+++ mm/memory.c 2001/07/16 08:05:46
@@ -102,9 +102,9 @@ static inline void free_one_pgd(pgd_t *
                 return;
         }
         pmd = pmd_offset(dir, 0);
- pgd_clear(dir);
         for (j = 0; j < PTRS_PER_PMD ; j++)
                 free_one_pmd(pmd+j);
+ pgd_clear(dir);
         pmd_free(pmd);
 }
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 23 2001 - 21:00:06 EST