> On 18. Apr 2021, at 20:58, Andrew Parker <andrew%pmk1.net@localhost> wrote: > > Hi, > > While trying to setup an L2ARC on my amd64 Xen dom0, I noticed that almost no > data was feeding in to the cache. The counters in kstat.zfs.misc.arcstats.l2* > indicate the l2arc feed process must be stuck somewhere. Which counters and which values? > I think I've traced > the problem to l2arc_write_interval() called by l2arc_feed_thread(). It looks > like the l2arc_feed_thread() loop only runs once because the delay set by > l2arc_write_interval() is always too large. For me (-current, KVM) l2arc_feed_thread() runs every second or every 0.15 second under load, tested with this patch: l2arc_feed_thread(void *dummy __unused) ... while (l2arc_thread_exit == 0) { CALLB_CPR_SAFE_BEGIN(&cpr); + printf("wait %u\n", next - ddi_get_lbolt()); > Maybe this is a difference between > NetBSD and Solaris cv_timedwait? Something like this results in a functioning > L2ARC on my system: > > --- a/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c > +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c > @@ -6520,7 +6520,7 @@ l2arc_write_size(void) > static clock_t > l2arc_write_interval(clock_t began, uint64_t wanted, uint64_t wrote) > { > - clock_t interval, next, now; > + clock_t interval; > > /* > * If the ARC lists are busy, increase our write rate; if the > @@ -6529,14 +6529,11 @@ l2arc_write_interval(clock_t began, uint64_t wanted, > uint64_t wrote) > * what we wanted, schedule the next write much sooner. > */ > if (l2arc_feed_again && wrote > (wanted / 2)) > - interval = (hz * l2arc_feed_min_ms) / 1000; > + interval = mstohz(l2arc_feed_min_ms) / 2; > else > - interval = hz * l2arc_feed_secs; > + interval = mstohz(l2arc_feed_secs); > > - now = ddi_get_lbolt(); > - next = MAX(now, MIN(now + interval, began + interval)); > - > - return (next); > + return (interval); > } This is completely wrong, l2arc_write_interval() must return next time, not a fixed interval. > This is on NetBSD-9. I hope I haven't missed something obvious in setup here. > Does anyone else have a working L2ARC? > > Thanks, > Andrew -- J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)
Attachment:
signature.asc
Description: Message signed with OpenPGP