FreeBSD Bugzilla – Attachment 187071 Details for
Bug 221356
[patch] Improve swapon_check_swzone() function in swap_pager.c
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
set vm_swap_enabled=1 after swap zones are initialized
vm_swap_enabled.diff (text/plain), 3.09 KB, created by
ota
on 2017-10-11 05:22:34 UTC
(
hide
)
Description:
set vm_swap_enabled=1 after swap zones are initialized
Filename:
MIME Type:
Creator:
ota
Created:
2017-10-11 05:22:34 UTC
Size:
3.09 KB
patch
obsolete
>Index: sys/vm/swap_pager.c >=================================================================== >--- sys/vm/swap_pager.c (revision 324512) >+++ sys/vm/swap_pager.c (working copy) >@@ -518,13 +530,17 @@ > swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, > pctrie_zone_init, NULL, UMA_ALIGN_PTR, > UMA_ZONE_NOFREE | UMA_ZONE_VM); >- if (swpctrie_zone == NULL) >- panic("failed to create swap pctrie zone."); >+ if (swpctrie_zone == NULL) { >+ printf("failed to create swap pctrie zone.\n"); >+ goto error; >+ } > swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL, > NULL, NULL, _Alignof(struct swblk) - 1, > UMA_ZONE_NOFREE | UMA_ZONE_VM); >- if (swblk_zone == NULL) >- panic("failed to create swap blk zone."); >+ if (swblk_zone == NULL) { >+ printf("failed to create swap blk zone.\n"); >+ goto error; >+ } > n2 = n; > do { > if (uma_zone_reserve_kva(swblk_zone, n)) >@@ -546,8 +573,24 @@ > swap_maxpages = n * SWAP_META_PAGES; > swzone = n * sizeof(struct swblk); > if (!uma_zone_reserve_kva(swpctrie_zone, n)) > printf("Cannot reserve swap pctrie zone, " > "reduce kern.maxswzone.\n"); >+#if !defined(NO_SWAPPING) >+ vm_swap_enabled = 1; >+#endif >+ return; >+error: >+ /* This works okay and disables swapping like swapon command. >+ However,uma_zone_reserve_kva allocates memory from KVA. >+ It will be much better enhancement if we can free them, too */ >+ if (swblk_zone != NULL) { >+ uma_zdestroy(swblk_zone); >+ swblk_zone = NULL; >+ } >+ if (swpctrie_zone != NULL) { >+ uma_zdestroy(swpctrie_zone); >+ swpctrie_zone = NULL; >+ } > } > > static vm_object_t >Index: sys/vm/vm_pageout.c >=================================================================== >--- sys/vm/vm_pageout.c (revision 324512) >+++ sys/vm/vm_pageout.c (working copy) >@@ -183,13 +183,8 @@ > static int lowmem_period = 10; > static time_t lowmem_uptime; > >-#if defined(NO_SWAPPING) >-static int vm_swap_enabled = 0; >+int vm_swap_enabled = 0; > static int vm_swap_idle_enabled = 0; >-#else >-static int vm_swap_enabled = 1; >-static int vm_swap_idle_enabled = 0; >-#endif > > static int vm_panic_on_oom = 0; > >@@ -211,14 +206,12 @@ > #if defined(NO_SWAPPING) > SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, > CTLFLAG_RD, &vm_swap_enabled, 0, "Enable entire process swapout"); >-SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled, >- CTLFLAG_RD, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria"); > #else > SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, > CTLFLAG_RW, &vm_swap_enabled, 0, "Enable entire process swapout"); >+#endif > SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled, > CTLFLAG_RW, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria"); >-#endif > > SYSCTL_INT(_vm, OID_AUTO, disable_swapspace_pageouts, > CTLFLAG_RW, &disable_swap_pageouts, 0, "Disallow swapout of dirty pages"); >Index: sys/vm/vm_pageout.h >=================================================================== >--- sys/vm/vm_pageout.h (revision 324512) >+++ sys/vm/vm_pageout.h (working copy) >@@ -76,6 +76,7 @@ > extern int vm_pageout_page_count; > extern bool vm_pageout_wanted; > extern bool vm_pages_needed; >+extern int vm_swap_enabled; > > /* > * Swap out requests
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 221356
:
185184
|
187070
| 187071