FreeBSD Bugzilla – Attachment 174197 Details for
Bug 187594
[zfs] [patch] ZFS ARC behavior problem and fix
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
First cut against 11.0-STABLE
patch-11.0-STABLE-r305005 (text/plain), 3.43 KB, created by
karl
on 2016-08-29 17:24:13 UTC
(
hide
)
Description:
First cut against 11.0-STABLE
Filename:
MIME Type:
Creator:
karl
Created:
2016-08-29 17:24:13 UTC
Size:
3.43 KB
patch
obsolete
>Index: cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c >=================================================================== >--- cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c (revision 305005) >+++ cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c (working copy) >@@ -237,7 +237,16 @@ int zfs_arc_p_min_shift = 0; > int zfs_disable_dup_eviction = 0; > uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */ > u_int zfs_arc_free_target = 0; >+u_int zfs_arc_wakeup_pager = 0; >+u_int zfs_arc_wakeup_delay = 500; > >+#define WAKE_PAGER >+#ifdef WAKE_PAGER >+#define WAKE_PAGER_CONSTANT 10 / 9 /* Pager wakeup threshold */ >+static int arc_init_done = 0; /* After arc_warm is valid */ >+extern void pagedaemon_wakeup(void); >+#endif >+ > /* Absolute min for arc min / max is 16MB. */ > static uint64_t arc_abs_min = 16 << 20; > >@@ -252,6 +261,7 @@ arc_free_target_init(void *unused __unused) > { > > zfs_arc_free_target = vm_pageout_wakeup_thresh; >+ zfs_arc_wakeup_pager = zfs_arc_free_target * WAKE_PAGER_CONSTANT; > } > SYSINIT(arc_free_target_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_ANY, > arc_free_target_init, NULL); >@@ -3476,6 +3486,11 @@ int64_t arc_pages_pp_reserve = 64; > int64_t arc_swapfs_reserve = 64; > > /* >+ * Declare file-local static for event processor bypass >+ */ >+static unsigned int arc_no_wake_event = 0; >+ >+/* > * Return the amount of memory that can be consumed before reclaim will be > * needed. Positive if there is sufficient free memory, negative indicates > * the amount of memory that needs to be freed up. >@@ -3488,6 +3503,12 @@ arc_available_memory(void) > free_memory_reason_t r = FMR_UNKNOWN; > > #ifdef _KERNEL >+#ifdef WAKE_PAGER >+ sbintime_t now; >+ static sbintime_t last_pagedaemon_wake = 0; >+ void call_arc_kmem_reap(void); >+#endif /* WAKE_PAGER */ >+ > if (needfree > 0) { > n = PAGESIZE * (-needfree); > if (n < lowest) { >@@ -3495,6 +3516,25 @@ arc_available_memory(void) > r = FMR_NEEDFREE; > } > } >+#ifdef WAKE_PAGER >+/* >+ * If memory is less than the ARC wakeup threshold and time has expired since >+ * the last time we woke the pager... Do not execute until the ARC warms up. >+ */ >+ if ((arc_init_done) && >+ (((int64_t) freemem - zfs_arc_wakeup_pager) < 0) && >+ (arc_warm == B_TRUE) >+ ) { >+ now = getsbinuptime(); >+ if ((now - last_pagedaemon_wake) / SBT_1MS > zfs_arc_wakeup_delay) { >+ last_pagedaemon_wake = now; >+ arc_no_wake_event++; /* Set bypass flag for ARC */ >+ call_arc_kmem_reap(); /* Reap caches if we're close */ >+ DTRACE_PROBE(arc__wake_pagedaemon); >+ (void) pagedaemon_wakeup(); /* Wake the pager */ >+ } >+ } >+#endif /* WAKE_PAGER */ > > /* > * Cooperate with pagedaemon when it's time for it to scan >@@ -3684,6 +3724,11 @@ arc_kmem_reap_now(void) > DTRACE_PROBE(arc__kmem_reap_end); > } > >+void call_arc_kmem_reap() >+{ >+ arc_kmem_reap_now(); >+} >+ > /* > * Threads can block in arc_get_data_buf() waiting for this thread to evict > * enough data and signal them to proceed. When this happens, the threads in >@@ -5431,6 +5476,10 @@ static eventhandler_tag arc_event_lowmem = NULL; > static void > arc_lowmem(void *arg __unused, int howto __unused) > { >+ if (arc_no_wake_event) { /* Don't do it if we woke the pager */ >+ arc_no_wake_event = 0; /* Just clear the flag */ >+ return; >+ } > > mutex_enter(&arc_reclaim_lock); > /* XXX: Memory deficit should be passed as argument. */ >@@ -5696,6 +5745,9 @@ arc_init(void) > printf(" in /boot/loader.conf.\n"); > } > #endif >+#ifdef WAKE_PAGER >+ arc_init_done++; >+#endif /* WAKE_PAGER */ > } > > void
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 187594
:
140882
|
140883
|
140884
|
140885
|
140886
|
140887
|
140888
|
140889
|
140890
|
140891
|
140892
|
146178
|
146203
|
146249
|
146251
|
146287
|
146300
|
146373
|
146423
|
146424
|
146456
|
146816
|
146817
|
146851
|
146852
|
146854
|
146859
|
146861
|
146946
|
146947
|
146948
|
146949
|
147014
|
147068
|
147069
|
147070
|
147265
|
147274
|
147275
|
147276
|
147286
|
147459
|
147607
|
147609
|
147733
|
147738
|
147754
|
147815
|
152852
|
158809
|
159207
|
159688
|
159859
|
159905
|
161691
|
161692
|
161943
|
164051
|
174197
|
174198
|
174231
|
174232
|
174254
|
186818