View | Details | Raw Unified | Return to bug 221356 | Differences between
and this patch

Collapse All | Expand All

(-)sys/vm/swap_pager.c (-4 / +24 lines)
Lines 518-530 Link Here
518
	swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL,
530
	swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL,
519
	    pctrie_zone_init, NULL, UMA_ALIGN_PTR,
531
	    pctrie_zone_init, NULL, UMA_ALIGN_PTR,
520
	    UMA_ZONE_NOFREE | UMA_ZONE_VM);
532
	    UMA_ZONE_NOFREE | UMA_ZONE_VM);
521
	if (swpctrie_zone == NULL)
533
	if (swpctrie_zone == NULL) {
522
		panic("failed to create swap pctrie zone.");
534
		printf("failed to create swap pctrie zone.\n");
535
		goto error;
536
	}
523
	swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL,
537
	swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL,
524
	    NULL, NULL, _Alignof(struct swblk) - 1,
538
	    NULL, NULL, _Alignof(struct swblk) - 1,
525
	    UMA_ZONE_NOFREE | UMA_ZONE_VM);
539
	    UMA_ZONE_NOFREE | UMA_ZONE_VM);
526
	if (swblk_zone == NULL)
540
	if (swblk_zone == NULL) {
527
		panic("failed to create swap blk zone.");
541
		printf("failed to create swap blk zone.\n");
542
		goto error;
543
	}
528
	n2 = n;
544
	n2 = n;
529
	do {
545
	do {
530
		if (uma_zone_reserve_kva(swblk_zone, n))
546
		if (uma_zone_reserve_kva(swblk_zone, n))
Lines 546-553 Link Here
546
	swap_maxpages = n * SWAP_META_PAGES;
573
	swap_maxpages = n * SWAP_META_PAGES;
547
	swzone = n * sizeof(struct swblk);
574
	swzone = n * sizeof(struct swblk);
548
	if (!uma_zone_reserve_kva(swpctrie_zone, n))
575
	if (!uma_zone_reserve_kva(swpctrie_zone, n))
549
		printf("Cannot reserve swap pctrie zone, "
576
		printf("Cannot reserve swap pctrie zone, "
550
		    "reduce kern.maxswzone.\n");
577
		    "reduce kern.maxswzone.\n");
578
#if !defined(NO_SWAPPING)
579
	vm_swap_enabled = 1;
580
#endif
581
	return;
582
error:
583
	/* This works okay and disables swapping like swapon command.
584
	   However,uma_zone_reserve_kva allocates memory from KVA.
585
	   It will be much better enhancement if we can free them, too */
586
	if (swblk_zone != NULL) {
587
	    uma_zdestroy(swblk_zone);
588
	    swblk_zone = NULL;
589
	}
590
	if (swpctrie_zone != NULL) {
591
	    uma_zdestroy(swpctrie_zone);
592
	    swpctrie_zone = NULL;
593
	}
551
}
594
}
552
595
553
static vm_object_t
596
static vm_object_t
(-)sys/vm/vm_pageout.c (-9 / +2 lines)
Lines 183-195 Link Here
183
static int lowmem_period = 10;
183
static int lowmem_period = 10;
184
static time_t lowmem_uptime;
184
static time_t lowmem_uptime;
185
185
186
#if defined(NO_SWAPPING)
186
int vm_swap_enabled = 0;
187
static int vm_swap_enabled = 0;
188
static int vm_swap_idle_enabled = 0;
187
static int vm_swap_idle_enabled = 0;
189
#else
190
static int vm_swap_enabled = 1;
191
static int vm_swap_idle_enabled = 0;
192
#endif
193
188
194
static int vm_panic_on_oom = 0;
189
static int vm_panic_on_oom = 0;
195
190
Lines 211-224 Link Here
211
#if defined(NO_SWAPPING)
206
#if defined(NO_SWAPPING)
212
SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled,
207
SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled,
213
	CTLFLAG_RD, &vm_swap_enabled, 0, "Enable entire process swapout");
208
	CTLFLAG_RD, &vm_swap_enabled, 0, "Enable entire process swapout");
214
SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled,
215
	CTLFLAG_RD, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria");
216
#else
209
#else
217
SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled,
210
SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled,
218
	CTLFLAG_RW, &vm_swap_enabled, 0, "Enable entire process swapout");
211
	CTLFLAG_RW, &vm_swap_enabled, 0, "Enable entire process swapout");
212
#endif
219
SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled,
213
SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled,
220
	CTLFLAG_RW, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria");
214
	CTLFLAG_RW, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria");
221
#endif
222
215
223
SYSCTL_INT(_vm, OID_AUTO, disable_swapspace_pageouts,
216
SYSCTL_INT(_vm, OID_AUTO, disable_swapspace_pageouts,
224
	CTLFLAG_RW, &disable_swap_pageouts, 0, "Disallow swapout of dirty pages");
217
	CTLFLAG_RW, &disable_swap_pageouts, 0, "Disallow swapout of dirty pages");
(-)sys/vm/vm_pageout.h (+1 lines)
Lines 76-81 Link Here
76
extern int vm_pageout_page_count;
76
extern int vm_pageout_page_count;
77
extern bool vm_pageout_wanted;
77
extern bool vm_pageout_wanted;
78
extern bool vm_pages_needed;
78
extern bool vm_pages_needed;
79
extern int vm_swap_enabled;
79
80
80
/*
81
/*
81
 * Swap out requests
82
 * Swap out requests

Return to bug 221356