Mon Jul 20 03:51:42 2009 UTC ()
Globalize uvm_emap_size.  It use to calculate size of kernel page table.
  http://mail-index.netbsd.org/current-users/2009/07/13/msg009983.html


(kiyohara)
diff -r1.3 -r1.4 src/sys/uvm/uvm_emap.c
diff -r1.21 -r1.22 src/sys/uvm/uvm_param.h

cvs diff -r1.3 -r1.4 src/sys/uvm/Attic/uvm_emap.c (expand / switch to unified diff)

--- src/sys/uvm/Attic/uvm_emap.c 2009/07/19 15:17:29 1.3
+++ src/sys/uvm/Attic/uvm_emap.c 2009/07/20 03:51:42 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_emap.c,v 1.3 2009/07/19 15:17:29 rmind Exp $ */ 1/* $NetBSD: uvm_emap.c,v 1.4 2009/07/20 03:51:42 kiyohara Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Mindaugas Rasiukevicius and Andrew Doran. 8 * by Mindaugas Rasiukevicius and Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -36,52 +36,52 @@ @@ -36,52 +36,52 @@
36 * do not support pmap. 36 * do not support pmap.
37 * 37 *
38 * Note that uvm_emap_update() is called from lower pmap(9) layer, while 38 * Note that uvm_emap_update() is called from lower pmap(9) layer, while
39 * other functions call to pmap(9). Typical pattern of update in pmap: 39 * other functions call to pmap(9). Typical pattern of update in pmap:
40 * 40 *
41 * u_int gen = uvm_emap_gen_return(); 41 * u_int gen = uvm_emap_gen_return();
42 * tlbflush(); 42 * tlbflush();
43 * uvm_emap_update(); 43 * uvm_emap_update();
44 * 44 *
45 * It is also used from IPI context, therefore functions must safe. 45 * It is also used from IPI context, therefore functions must safe.
46 */ 46 */
47 47
48#include <sys/cdefs.h> 48#include <sys/cdefs.h>
49__KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.3 2009/07/19 15:17:29 rmind Exp $"); 49__KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.4 2009/07/20 03:51:42 kiyohara Exp $");
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53 53
54#include <sys/atomic.h> 54#include <sys/atomic.h>
55#include <sys/lwp.h> 55#include <sys/lwp.h>
56#include <sys/vmem.h> 56#include <sys/vmem.h>
57#include <sys/types.h> 57#include <sys/types.h>
58 58
59#include <uvm/uvm.h> 59#include <uvm/uvm.h>
60#include <uvm/uvm_extern.h> 60#include <uvm/uvm_extern.h>
61 61
62/* XXX: Arbitrary. */ 62/* XXX: Arbitrary. */
63#ifdef _LP64 63#ifdef _LP64
64#define UVM_EMAP_SIZE (128 * 1024 * 1024) /* 128 MB */ 64#define UVM_EMAP_SIZE (128 * 1024 * 1024) /* 128 MB */
65#else 65#else
66#define UVM_EMAP_SIZE (32 * 1024 * 1024) /* 32 MB */ 66#define UVM_EMAP_SIZE (32 * 1024 * 1024) /* 32 MB */
67#endif 67#endif
68 68
69static u_int _uvm_emap_gen[COHERENCY_UNIT - sizeof(u_int)] 69static u_int _uvm_emap_gen[COHERENCY_UNIT - sizeof(u_int)]
70 __aligned(COHERENCY_UNIT); 70 __aligned(COHERENCY_UNIT);
71 71
72#define uvm_emap_gen (_uvm_emap_gen[0]) 72#define uvm_emap_gen (_uvm_emap_gen[0])
73 73
74static u_int uvm_emap_size = UVM_EMAP_SIZE; 74u_int uvm_emap_size = UVM_EMAP_SIZE;
75static vaddr_t uvm_emap_va; 75static vaddr_t uvm_emap_va;
76static vmem_t * uvm_emap_vmem; 76static vmem_t * uvm_emap_vmem;
77 77
78/* 78/*
79 * uvm_emap_init: initialize subsystem. 79 * uvm_emap_init: initialize subsystem.
80 */ 80 */
81void 81void
82uvm_emap_sysinit(void) 82uvm_emap_sysinit(void)
83{ 83{
84 struct uvm_cpu *ucpu; 84 struct uvm_cpu *ucpu;
85 size_t qmax; 85 size_t qmax;
86 u_int i; 86 u_int i;
87 87

cvs diff -r1.21 -r1.22 src/sys/uvm/uvm_param.h (expand / switch to unified diff)

--- src/sys/uvm/uvm_param.h 2006/08/04 22:42:36 1.21
+++ src/sys/uvm/uvm_param.h 2009/07/20 03:51:42 1.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_param.h,v 1.21 2006/08/04 22:42:36 he Exp $ */ 1/* $NetBSD: uvm_param.h,v 1.22 2009/07/20 03:51:42 kiyohara Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1991, 1993 4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * The Mach Operating System project at Carnegie-Mellon University. 8 * The Mach Operating System project at Carnegie-Mellon University.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -235,25 +235,26 @@ @@ -235,25 +235,26 @@
235# endif /* !__HAVE_TOPDOWN_VM && !__USE_TOPDOWN_VM */ 235# endif /* !__HAVE_TOPDOWN_VM && !__USE_TOPDOWN_VM */
236#endif /* USE_TOPDOWN_VM || __USE_TOPDOWN_VM */ 236#endif /* USE_TOPDOWN_VM || __USE_TOPDOWN_VM */
237 237
238#if !defined(__USING_TOPDOWN_VM) 238#if !defined(__USING_TOPDOWN_VM)
239# if defined(VM_DEFAULT_ADDRESS) 239# if defined(VM_DEFAULT_ADDRESS)
240# error "Default vm address should not be defined here" 240# error "Default vm address should not be defined here"
241# else /* VM_DEFAULT_ADDRESS */ 241# else /* VM_DEFAULT_ADDRESS */
242# define VM_DEFAULT_ADDRESS(da, sz) round_page((vaddr_t)(da) + (vsize_t)maxdmap) 242# define VM_DEFAULT_ADDRESS(da, sz) round_page((vaddr_t)(da) + (vsize_t)maxdmap)
243# endif /* VM_DEFAULT_ADDRESS */ 243# endif /* VM_DEFAULT_ADDRESS */
244#endif /* !__USING_TOPDOWN_VM */ 244#endif /* !__USING_TOPDOWN_VM */
245 245
246extern int ubc_nwins; /* number of UBC mapping windows */ 246extern int ubc_nwins; /* number of UBC mapping windows */
247extern int ubc_winshift; /* shift for a UBC mapping window */ 247extern int ubc_winshift; /* shift for a UBC mapping window */
 248extern u_int uvm_emap_size; /* size of emap */
248 249
249#else 250#else
250/* out-of-kernel versions of round_page and trunc_page */ 251/* out-of-kernel versions of round_page and trunc_page */
251#define round_page(x) \ 252#define round_page(x) \
252 ((((vaddr_t)(x) + (vm_page_size - 1)) / vm_page_size) * \ 253 ((((vaddr_t)(x) + (vm_page_size - 1)) / vm_page_size) * \
253 vm_page_size) 254 vm_page_size)
254#define trunc_page(x) \ 255#define trunc_page(x) \
255 ((((vaddr_t)(x)) / vm_page_size) * vm_page_size) 256 ((((vaddr_t)(x)) / vm_page_size) * vm_page_size)
256 257
257#endif /* _KERNEL */ 258#endif /* _KERNEL */
258#endif /* ASSEMBLER */ 259#endif /* ASSEMBLER */
259#endif /* _VM_PARAM_ */ 260#endif /* _VM_PARAM_ */