6351310 assertion failed: (plcnt[mnode][mtype].plc_mt_clpgcnt...) vm_pagelist.c, line: 2239]
--- a/usr/src/uts/common/os/mem_cage.c Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/common/os/mem_cage.c Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -864,7 +864,7 @@
PP_SETNORELOC(pp);
}
}
-
+ PLCNT_XFER_NORELOC(pp);
wanted -= 1;
}
@@ -1237,13 +1237,14 @@
if (PP_ISFREE(pp)) {
int which = PP_ISAGED(pp) ? PG_FREE_LIST : PG_CACHE_LIST;
- page_list_sub(pp, which | PG_LIST_ISCAGE);
+ page_list_sub(pp, which);
ASSERT(pp->p_szc == 0);
PP_SETNORELOC(pp);
- page_list_add(pp, which | PG_LIST_TAIL | PG_LIST_ISCAGE);
+ page_list_add(pp, which | PG_LIST_TAIL);
page_unlock(pp);
*nfreedp = 1;
+ PLCNT_XFER_NORELOC(pp);
return (0);
} else {
if (pp->p_szc != 0) {
@@ -1255,7 +1256,7 @@
} else {
PP_SETNORELOC(pp);
}
- page_list_xfer(pp, MTYPE_NORELOC, MTYPE_RELOC);
+ PLCNT_XFER_NORELOC(pp);
return (kcage_invalidate_page(pp, nfreedp));
}
/*NOTREACHED*/
--- a/usr/src/uts/common/os/mem_config.c Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/common/os/mem_config.c Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -51,6 +51,7 @@
#include <vm/seg_kmem.h>
#include <vm/seg_kpm.h>
#include <vm/page.h>
+#include <vm/vm_dep.h>
#define SUNDDI_IMPL /* so sunddi.h will not redefine splx() et al */
#include <sys/sunddi.h>
#include <sys/mem_config.h>
@@ -437,6 +438,8 @@
page_free(pp, 1);
}
+ PLCNT_MODIFY_MAX(seg->pages_base, (long)npgs);
+
/*
* Now that we've updated the appropriate memory lists we
* need to reset a number of globals, since we've increased memory.
@@ -2545,6 +2548,9 @@
ASSERT(seg->pages_base >= mdsp->mds_base);
ASSERT(seg->pages_end <= p_end);
+ PLCNT_MODIFY_MAX(seg->pages_base,
+ seg->pages_base - seg->pages_end);
+
/* Hide the memseg from future scans. */
hat_kpm_delmem_mseg_update(seg, segpp);
*segpp = seg->next;
--- a/usr/src/uts/common/vm/page.h Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/common/vm/page.h Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -633,7 +633,6 @@
/* called from */
#define PG_LIST_ISINIT 0x1000
-#define PG_LIST_ISCAGE 0x2000
/*
* Page frame operations.
--- a/usr/src/uts/common/vm/vm_page.c Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/common/vm/vm_page.c Wed Feb 01 19:12:56 2006 -0800
@@ -537,6 +537,8 @@
total_pages += num;
set_max_page_get(total_pages);
+ PLCNT_MODIFY_MAX(pnum, (long)num);
+
/*
* The physical space for the pages array
* representing ram pages has already been
--- a/usr/src/uts/common/vm/vm_pagelist.c Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/common/vm/vm_pagelist.c Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1059,18 +1059,6 @@
}
/*
- * update the page list max counts for already allocated pages that has xfer'ed
- * (kcage_assimilate_page) between different mtypes.
- */
-/* ARGSUSED */
-void
-page_list_xfer(page_t *pp, int to_mtype, int from_mtype)
-{
- PLCNT_MAX_INCR(pp, PP_2_MEM_NODE(pp), to_mtype, pp->p_szc);
- PLCNT_MAX_DECR(pp, PP_2_MEM_NODE(pp), from_mtype, pp->p_szc);
-}
-
-/*
* add pp to the specified page list. Defaults to head of the page list
* unless PG_LIST_TAIL is specified.
*/
@@ -1174,7 +1162,7 @@
uint_t bin;
int mnode;
int mtype;
- int flags = PG_LIST_ISCAGE;
+ int flags = 0;
/*
* If this is a large page on the freelist then
--- a/usr/src/uts/i86pc/vm/vm_dep.h Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/i86pc/vm/vm_dep.h Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -105,9 +105,6 @@
}
#define PLCNT_DO(pp, mtype, szc, cnt, flags) { \
int bin = PP_2_BIN(pp); \
- if (flags & PG_LIST_ISINIT) \
- mnoderanges[mtype].mnr_mt_pgmax += cnt; \
- ASSERT((flags & PG_LIST_ISCAGE) == 0); \
if (flags & PG_CACHE_LIST) \
atomic_add_long(&mnoderanges[mtype]. \
mnr_mt_clpgcnt, cnt); \
@@ -126,8 +123,6 @@
#define PLCNT_SZ(ctrs_sz)
#define PLCNT_INIT(base)
#define PLCNT_DO(pp, mtype, szc, cnt, flags) { \
- if (flags & PG_LIST_ISINIT) \
- mnoderanges[mtype].mnr_mt_pgmax += cnt; \
if (flags & PG_CACHE_LIST) \
atomic_add_long(&mnoderanges[mtype]. \
mnr_mt_clpgcnt, cnt); \
@@ -145,10 +140,6 @@
ASSERT(mtype == PP_2_MTYPE(pp)); \
if (physmax4g && mtype <= mtype4g) \
atomic_add_long(&freemem4g, cnt); \
- if (flags & PG_LIST_ISINIT) { \
- if (physmax4g && mtype <= mtype4g) \
- maxmem4g += cnt; \
- } \
PLCNT_DO(pp, mtype, szc, cnt, flags); \
}
@@ -163,8 +154,9 @@
/*
* macros to update page list max counts. no-op on x86.
*/
-#define PLCNT_MAX_INCR(pp, mnode, mtype, szc)
-#define PLCNT_MAX_DECR(pp, mnode, mtype, szc)
+#define PLCNT_XFER_NORELOC(pp)
+
+#define PLCNT_MODIFY_MAX(pfn, cnt) mtype_modify_max(pfn, (pgcnt_t)cnt)
extern mnoderange_t *mnoderanges;
extern int mnoderangecnt;
@@ -213,6 +205,7 @@
extern int memrange_num(pfn_t);
extern int pfn_2_mtype(pfn_t);
extern int mtype_func(int, int, uint_t);
+extern void mtype_modify_max(pfn_t, long);
extern int mnode_pgcnt(int);
#define NUM_MEM_RANGES 4 /* memory range types */
--- a/usr/src/uts/i86pc/vm/vm_machdep.c Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/i86pc/vm/vm_machdep.c Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1023,6 +1023,37 @@
}
/*
+ * Update the page list max counts with the pfn range specified by the
+ * input parameters. Called from add_physmem() when physical memory with
+ * page_t's are initially added to the page lists.
+ */
+void
+mtype_modify_max(pfn_t startpfn, long cnt)
+{
+ int mtype = 0;
+ pfn_t endpfn = startpfn + cnt, pfn;
+ pgcnt_t inc;
+
+ ASSERT(cnt > 0);
+
+ for (pfn = startpfn; pfn < endpfn; ) {
+ if (pfn <= mnoderanges[mtype].mnr_pfnhi) {
+ if (endpfn < mnoderanges[mtype].mnr_pfnhi) {
+ inc = endpfn - pfn;
+ } else {
+ inc = mnoderanges[mtype].mnr_pfnhi - pfn + 1;
+ }
+ mnoderanges[mtype].mnr_mt_pgmax += inc;
+ if (physmax4g && mtype <= mtype4g)
+ maxmem4g += inc;
+ pfn += inc;
+ }
+ mtype++;
+ ASSERT(mtype < mnoderangecnt || pfn >= endpfn);
+ }
+}
+
+/*
* Returns the free page count for mnode
*/
int
--- a/usr/src/uts/sun4/vm/vm_dep.h Wed Feb 01 18:40:29 2006 -0800
+++ b/usr/src/uts/sun4/vm/vm_dep.h Wed Feb 01 19:12:56 2006 -0800
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -173,9 +173,6 @@
#define PLCNT_DO(pp, mn, mtype, szc, cnt, flags) { \
int bin = PP_2_BIN(pp); \
- if (flags & (PG_LIST_ISINIT | PG_LIST_ISCAGE)) \
- atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, \
- cnt); \
if (flags & PG_CACHE_LIST) \
atomic_add_long(&plcnt[mn][mtype].plc_mt_clpgcnt, cnt); \
else if (szc) \
@@ -197,8 +194,6 @@
/* PG_FREE_LIST may not be explicitly set in flags for large pages */
#define PLCNT_DO(pp, mn, mtype, szc, cnt, flags) { \
- if (flags & (PG_LIST_ISINIT | PG_LIST_ISCAGE)) \
- atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \
if (flags & PG_CACHE_LIST) \
atomic_add_long(&plcnt[mn][mtype].plc_mt_clpgcnt, cnt); \
else if (szc) \
@@ -221,16 +216,25 @@
/*
* macros to update page list max counts - done when pages transferred
- * between mtypes (as in kcage_assimilate_page).
+ * from RELOC to NORELOC mtype (kcage_init or kcage_assimilate_page).
*/
-#define PLCNT_MAX_INCR(pp, mn, mtype, szc) { \
- long cnt = (1 << PAGE_BSZS_SHIFT(szc)); \
- atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \
+
+#define PLCNT_XFER_NORELOC(pp) { \
+ long cnt = (1 << PAGE_BSZS_SHIFT((pp)->p_szc)); \
+ int mn = PP_2_MEM_NODE(pp); \
+ atomic_add_long(&plcnt[mn][MTYPE_NORELOC].plc_mt_pgmax, cnt); \
+ atomic_add_long(&plcnt[mn][MTYPE_RELOC].plc_mt_pgmax, -cnt); \
}
-#define PLCNT_MAX_DECR(pp, mn, mtype, szc) { \
- long cnt = ((-1) << PAGE_BSZS_SHIFT(szc)); \
- atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \
+/*
+ * macro to modify the page list max counts when memory is added to
+ * the page lists during startup (add_physmem) or during a DR operation
+ * when memory is added (kphysm_add_memory_dynamic) or deleted
+ * (kphysm_del_cleanup).
+ */
+#define PLCNT_MODIFY_MAX(pfn, cnt) { \
+ int mn = PFN_2_MEM_NODE(pfn); \
+ atomic_add_long(&plcnt[mn][MTYPE_RELOC].plc_mt_pgmax, (cnt)); \
}
extern plcnt_t plcnt;