NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-evbarm/56944: ZFS heavy usage on NetBSD running in Mac M1 VM results in kernel thread running away and filesystem hang



The following reply was made to PR port-evbarm/56944; it has been noted by GNATS.

From: Tobias Nygren <tnn%NetBSD.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-evbarm/56944: ZFS heavy usage on NetBSD running in Mac M1
 VM results in kernel thread running away and filesystem hang
Date: Thu, 28 Jul 2022 06:00:20 +0200

 This patch helps for me by limiting ARC to 50% of kmem heap.
 Not sure why exactly that helps. With this and the additional
 starvation check pagedaemon doesn't go crazy. There is still a memory
 leak that slowly consumes pool memory when creating many small files
 but it may be a different issue. I could run 4 parallel "tar -xzf
 src.tgz". Without the patch it would hang within 20 seconds.
 
 --- external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	4 May 2022 15:49:55 -0000	1.21
 +++ external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	28 Jul 2022 03:28:31 -0000
 @@ -4004,6 +4004,17 @@ arc_available_memory(void)
  		}
  	}
  
 +#if defined(__NetBSD__) && defined(_KERNEL)
 +	if (uvm_km_va_starved_p()) {
 +		n = (int64_t)vmem_size(heap_arena, VMEM_FREE) -
 +		    (vmem_size(heap_arena, VMEM_ALLOC|VMEM_FREE) / 10);
 +		if (n < lowest) {
 +			lowest = n;
 +			r = FMR_HEAP_ARENA;
 +		}
 +       }
 +#endif
 +
  #if __FreeBSD__
  	/*
  	 * Above limits know nothing about real level of KVA fragmentation.
 @@ -6098,6 +6109,10 @@ arc_init(void)
  	else
  		arc_c_max = arc_c_min;
  	arc_c_max = MAX(arc_c * 5, arc_c_max);
 +#if defined(__NetBSD__) && defined(_KERNEL)
 +/* XXX prevent ARC from eating more than 50% of kmem */
 +	arc_c_max = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 2);
 +#endif
  
  	/*
  	 * In userland, there's only the memory pressure that we artificially
 


Home | Main Index | Thread Index | Old Index