Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 Fix memory leak. it wa...



details:   https://anonhg.NetBSD.org/src/rev/f7150dc0f8c3
branches:  trunk
changeset: 319090:f7150dc0f8c3
user:      ryo <ryo%NetBSD.org@localhost>
date:      Wed May 16 08:32:07 2018 +0000

description:
Fix memory leak. it was leaking one page every pmap_create().
pm->pm_vmlist must be initialized before calling _pmap_alloc_pdp().

diffstat:

 sys/arch/aarch64/aarch64/pmap.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 7ce67beb6c94 -r f7150dc0f8c3 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Wed May 16 08:16:36 2018 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Wed May 16 08:32:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $     */
+/*     $NetBSD: pmap.c,v 1.6 2018/05/16 08:32:07 ryo Exp $     */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.6 2018/05/16 08:32:07 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1229,10 +1229,10 @@
        memset(pm, 0, sizeof(*pm));
        pm->pm_refcnt = 1;
        pm->pm_asid = -1;
+       SLIST_INIT(&pm->pm_vmlist);
+       mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_VM);
        pm->pm_l0table = _pmap_alloc_pdp(pm, &pm->pm_l0table_pa);
        KASSERT(((vaddr_t)pm->pm_l0table & (PAGE_SIZE - 1)) == 0);
-       SLIST_INIT(&pm->pm_vmlist);
-       mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_VM);
 
        UVMHIST_LOG(pmaphist, "pm=%p, pm_l0table=%016lx, pm_l0table_pa=%016lx",
            pm, pm->pm_l0table, pm->pm_l0table_pa, 0);



Home | Main Index | Thread Index | Old Index