Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2012 11:53:55 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242218 - in head/sys/ia64: ia64 include
Message-ID:  <201210281153.q9SBrtAv099265@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Oct 28 11:53:54 2012
New Revision: 242218
URL: http://svn.freebsd.org/changeset/base/242218

Log:
  Fix compilation on ia64 when page size is configured for 16KB.
  
  Reviewed by:	alc, marcel

Modified:
  head/sys/ia64/ia64/pmap.c
  head/sys/ia64/include/pmap.h

Modified: head/sys/ia64/ia64/pmap.c
==============================================================================
--- head/sys/ia64/ia64/pmap.c	Sun Oct 28 11:27:54 2012	(r242217)
+++ head/sys/ia64/ia64/pmap.c	Sun Oct 28 11:53:54 2012	(r242218)
@@ -140,6 +140,29 @@ extern uint64_t ia64_gateway_page[];
 #define	pmap_set_wired(lpte)		(lpte)->pte |= PTE_WIRED
 
 /*
+ * Individual PV entries are stored in per-pmap chunks.  This saves
+ * space by eliminating the need to record the pmap within every PV
+ * entry.
+ */
+#if PAGE_SIZE == 8192
+#define	_NPCM	6
+#define	_NPCPV	337
+#define	_NPCS	2
+#elif PAGE_SIZE == 16384
+#define	_NPCM	11
+#define	_NPCPV	677
+#define	_NPCS	1
+#endif
+struct pv_chunk {
+	pmap_t			pc_pmap;
+	TAILQ_ENTRY(pv_chunk)	pc_list;
+	u_long			pc_map[_NPCM];	/* bitmap; 1 = free */
+	TAILQ_ENTRY(pv_chunk)	pc_lru;
+	u_long			pc_spare[_NPCS];
+	struct pv_entry		pc_pventry[_NPCPV];
+};
+
+/*
  * The VHPT bucket head structure.
  */
 struct ia64_bucket {
@@ -693,8 +716,6 @@ pmap_growkernel(vm_offset_t addr)
  ***************************************************/
 
 CTASSERT(sizeof(struct pv_chunk) == PAGE_SIZE);
-CTASSERT(_NPCM == 6);
-CTASSERT(_NPCPV == 337);
 
 static __inline struct pv_chunk *
 pv_to_chunk(pv_entry_t pv)
@@ -705,13 +726,23 @@ pv_to_chunk(pv_entry_t pv)
 
 #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap)
 
-#define	PC_FREE0_4	0xfffffffffffffffful
-#define	PC_FREE5	0x000000000001fffful
+#define	PC_FREE_FULL	0xfffffffffffffffful
+#define	PC_FREE_PARTIAL	\
+	((1UL << (_NPCPV - sizeof(u_long) * 8 * (_NPCM - 1))) - 1)
 
+#if PAGE_SIZE == 8192
 static const u_long pc_freemask[_NPCM] = {
-	PC_FREE0_4, PC_FREE0_4, PC_FREE0_4,
-	PC_FREE0_4, PC_FREE0_4, PC_FREE5
+	PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+	PC_FREE_FULL, PC_FREE_FULL, PC_FREE_PARTIAL
 };
+#elif PAGE_SIZE == 16384
+static const u_long pc_freemask[_NPCM] = {
+	PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+	PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+	PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+	PC_FREE_FULL, PC_FREE_PARTIAL
+};
+#endif
 
 static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 

Modified: head/sys/ia64/include/pmap.h
==============================================================================
--- head/sys/ia64/include/pmap.h	Sun Oct 28 11:27:54 2012	(r242217)
+++ head/sys/ia64/include/pmap.h	Sun Oct 28 11:53:54 2012	(r242218)
@@ -105,21 +105,6 @@ typedef struct pv_entry {
 	TAILQ_ENTRY(pv_entry)	pv_list;
 } *pv_entry_t;
 
-/*
- * pv_entries are allocated in chunks per-process.  This avoids the
- * need to track per-pmap assignments.
- */
-#define	_NPCM	6
-#define	_NPCPV	337
-struct pv_chunk {
-	pmap_t			pc_pmap;
-	TAILQ_ENTRY(pv_chunk)	pc_list;
-	u_long			pc_map[_NPCM];	/* bitmap; 1 = free */
-	TAILQ_ENTRY(pv_chunk)	pc_lru;
-	u_long			pc_spare[2];
-	struct pv_entry		pc_pventry[_NPCPV];
-};
-
 #ifdef	_KERNEL
 
 extern vm_paddr_t phys_avail[];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210281153.q9SBrtAv099265>