Re: pool_setipl for src/sys/uvm

2016-06-13 Thread Mark Kettenis
> Date: Mon, 13 Jun 2016 14:27:53 +1000
> From: David Gwynne 
> 
> this adds pool_setipl to the pools in src/sys/uvm.
> 
> this assumes that the various things are only allocated and freed
> from a process context. if any of these are released from an interrupt
> we should probably set them to IPL_VM.
> 
> ok?

The IPL_VM for uvm_map_kmem_entry_pool is definitely not necessary.
That pool is only used for non-interrupt-safe maps, which means the
pool should never be used in interrupt-context.

That also means the existing IPL_VM for uvm_map_entry_pool shouldn't
be necessary either.  That would need some testing though, so it's
fine if you leave it like that for now (and perhaps add an XXX).

> Index: uvm_amap.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_amap.c,v
> retrieving revision 1.71
> diff -u -p -r1.71 uvm_amap.c
> --- uvm_amap.c26 May 2016 13:37:26 -  1.71
> +++ uvm_amap.c13 Jun 2016 04:26:23 -
> @@ -227,6 +227,7 @@ amap_init(void)
>   /* Initialize the vm_amap pool. */
>   pool_init(_amap_pool, sizeof(struct vm_amap), 0, 0, PR_WAITOK,
>   "amappl", NULL);
> + pool_setipl(_amap_pool, IPL_NONE);
>   pool_sethiwat(_amap_pool, 4096);
>  
>   /* initialize small amap pools */
> @@ -237,12 +238,14 @@ amap_init(void)
>   (i + 1) * sizeof(struct vm_anon *);
>   pool_init(_small_amap_pool[i], size, 0, 0, 0,
>   amap_small_pool_names[i], NULL);
> + pool_setipl(_small_amap_pool[i], IPL_NONE);
>   }
>  
>   pool_init(_amap_chunk_pool,
>   sizeof(struct vm_amap_chunk) +
>   UVM_AMAP_CHUNK * sizeof(struct vm_anon *), 0, 0, 0,
>   "amapchunkpl", NULL);
> + pool_setipl(_amap_chunk_pool, IPL_NONE);
>   pool_sethiwat(_amap_chunk_pool, 4096);
>  }
>  
> Index: uvm_anon.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_anon.c,v
> retrieving revision 1.46
> diff -u -p -r1.46 uvm_anon.c
> --- uvm_anon.c8 May 2016 11:52:32 -   1.46
> +++ uvm_anon.c13 Jun 2016 04:26:23 -
> @@ -50,6 +50,7 @@ uvm_anon_init(void)
>  {
>   pool_init(_anon_pool, sizeof(struct vm_anon), 0, 0,
>   PR_WAITOK, "anonpl", NULL);
> + pool_setipl(_anon_pool, IPL_NONE);
>   pool_sethiwat(_anon_pool, uvmexp.free / 16);
>  }
>  
> Index: uvm_aobj.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
> retrieving revision 1.80
> diff -u -p -r1.80 uvm_aobj.c
> --- uvm_aobj.c21 Aug 2015 16:04:35 -  1.80
> +++ uvm_aobj.c13 Jun 2016 04:26:23 -
> @@ -799,9 +799,11 @@ uao_init(void)
>*/
>   pool_init(_swhash_elt_pool, sizeof(struct uao_swhash_elt),
>   0, 0, PR_WAITOK, "uaoeltpl", NULL);
> + pool_setipl(_swhash_elt_pool, IPL_NONE);
>  
>   pool_init(_aobj_pool, sizeof(struct uvm_aobj), 0, 0, PR_WAITOK,
>   "aobjpl", NULL);
> + pool_setipl(_aobj_pool, IPL_NONE);
>  }
>  
>  /*
> Index: uvm_map.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_map.c,v
> retrieving revision 1.215
> diff -u -p -r1.215 uvm_map.c
> --- uvm_map.c 5 Jun 2016 08:35:57 -   1.215
> +++ uvm_map.c 13 Jun 2016 04:26:23 -
> @@ -2787,11 +2787,13 @@ uvm_map_init(void)
>   /* initialize the map-related pools. */
>   pool_init(_vmspace_pool, sizeof(struct vmspace),
>   0, 0, PR_WAITOK, "vmsppl", NULL);
> + pool_setipl(_vmspace_pool, IPL_NONE);
>   pool_init(_map_entry_pool, sizeof(struct vm_map_entry),
>   0, 0, PR_WAITOK, "vmmpepl", NULL);
>   pool_setipl(_map_entry_pool, IPL_VM);
>   pool_init(_map_entry_kmem_pool, sizeof(struct vm_map_entry),
>   0, 0, 0, "vmmpekpl", NULL);
> + pool_setipl(_map_entry_kmem_pool, IPL_VM);
>   pool_sethiwat(_map_entry_pool, 8192);
>  
>   uvm_addr_init();
> 
> 



pool_setipl for src/sys/uvm

2016-06-12 Thread David Gwynne
this adds pool_setipl to the pools in src/sys/uvm.

this assumes that the various things are only allocated and freed
from a process context. if any of these are released from an interrupt
we should probably set them to IPL_VM.

ok?

Index: uvm_amap.c
===
RCS file: /cvs/src/sys/uvm/uvm_amap.c,v
retrieving revision 1.71
diff -u -p -r1.71 uvm_amap.c
--- uvm_amap.c  26 May 2016 13:37:26 -  1.71
+++ uvm_amap.c  13 Jun 2016 04:26:23 -
@@ -227,6 +227,7 @@ amap_init(void)
/* Initialize the vm_amap pool. */
pool_init(_amap_pool, sizeof(struct vm_amap), 0, 0, PR_WAITOK,
"amappl", NULL);
+   pool_setipl(_amap_pool, IPL_NONE);
pool_sethiwat(_amap_pool, 4096);
 
/* initialize small amap pools */
@@ -237,12 +238,14 @@ amap_init(void)
(i + 1) * sizeof(struct vm_anon *);
pool_init(_small_amap_pool[i], size, 0, 0, 0,
amap_small_pool_names[i], NULL);
+   pool_setipl(_small_amap_pool[i], IPL_NONE);
}
 
pool_init(_amap_chunk_pool,
sizeof(struct vm_amap_chunk) +
UVM_AMAP_CHUNK * sizeof(struct vm_anon *), 0, 0, 0,
"amapchunkpl", NULL);
+   pool_setipl(_amap_chunk_pool, IPL_NONE);
pool_sethiwat(_amap_chunk_pool, 4096);
 }
 
Index: uvm_anon.c
===
RCS file: /cvs/src/sys/uvm/uvm_anon.c,v
retrieving revision 1.46
diff -u -p -r1.46 uvm_anon.c
--- uvm_anon.c  8 May 2016 11:52:32 -   1.46
+++ uvm_anon.c  13 Jun 2016 04:26:23 -
@@ -50,6 +50,7 @@ uvm_anon_init(void)
 {
pool_init(_anon_pool, sizeof(struct vm_anon), 0, 0,
PR_WAITOK, "anonpl", NULL);
+   pool_setipl(_anon_pool, IPL_NONE);
pool_sethiwat(_anon_pool, uvmexp.free / 16);
 }
 
Index: uvm_aobj.c
===
RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
retrieving revision 1.80
diff -u -p -r1.80 uvm_aobj.c
--- uvm_aobj.c  21 Aug 2015 16:04:35 -  1.80
+++ uvm_aobj.c  13 Jun 2016 04:26:23 -
@@ -799,9 +799,11 @@ uao_init(void)
 */
pool_init(_swhash_elt_pool, sizeof(struct uao_swhash_elt),
0, 0, PR_WAITOK, "uaoeltpl", NULL);
+   pool_setipl(_swhash_elt_pool, IPL_NONE);
 
pool_init(_aobj_pool, sizeof(struct uvm_aobj), 0, 0, PR_WAITOK,
"aobjpl", NULL);
+   pool_setipl(_aobj_pool, IPL_NONE);
 }
 
 /*
Index: uvm_map.c
===
RCS file: /cvs/src/sys/uvm/uvm_map.c,v
retrieving revision 1.215
diff -u -p -r1.215 uvm_map.c
--- uvm_map.c   5 Jun 2016 08:35:57 -   1.215
+++ uvm_map.c   13 Jun 2016 04:26:23 -
@@ -2787,11 +2787,13 @@ uvm_map_init(void)
/* initialize the map-related pools. */
pool_init(_vmspace_pool, sizeof(struct vmspace),
0, 0, PR_WAITOK, "vmsppl", NULL);
+   pool_setipl(_vmspace_pool, IPL_NONE);
pool_init(_map_entry_pool, sizeof(struct vm_map_entry),
0, 0, PR_WAITOK, "vmmpepl", NULL);
pool_setipl(_map_entry_pool, IPL_VM);
pool_init(_map_entry_kmem_pool, sizeof(struct vm_map_entry),
0, 0, 0, "vmmpekpl", NULL);
+   pool_setipl(_map_entry_kmem_pool, IPL_VM);
pool_sethiwat(_map_entry_pool, 8192);
 
uvm_addr_init();