Alexander, On Tue, Nov 19, 2013 at 10:05:53AM +0000, Alexander Motin wrote: A> Author: mav A> Date: Tue Nov 19 10:05:53 2013 A> New Revision: 258336 A> URL: http://svnweb.freebsd.org/changeset/base/258336 A> A> Log: A> Implement soft pressure on UMA cache bucket sizes. A> A> Every time system detects low memory condition decrease bucket sizes for A> each zone by one item. As result, higher memory pressure will push to A> smaller bucket sizes and so smaller per-CPU caches and so more efficient A> memory use. A> A> Before this change there was no force to oppose buckets growth as result A> of practically inevitable zone lock conflicts, and after some run time A> per-CPU caches could consume enough RAM to kill the system.
Brief review of patch tells me that system never recovers from this. uz_count it decremented only and never incremented. A> Modified: A> head/sys/vm/uma_core.c A> head/sys/vm/uma_int.h A> A> Modified: head/sys/vm/uma_core.c A> ============================================================================== A> --- head/sys/vm/uma_core.c Tue Nov 19 09:35:20 2013 (r258335) A> +++ head/sys/vm/uma_core.c Tue Nov 19 10:05:53 2013 (r258336) A> @@ -701,6 +701,13 @@ bucket_cache_drain(uma_zone_t zone) A> bucket_free(zone, bucket, NULL); A> ZONE_LOCK(zone); A> } A> + A> + /* A> + * Shrink further bucket sizes. Price of single zone lock collision A> + * is probably lower then price of global cache drain. A> + */ A> + if (zone->uz_count > zone->uz_count_min) A> + zone->uz_count--; A> } A> A> static void A> @@ -1461,6 +1468,7 @@ zone_ctor(void *mem, int size, void *uda A> zone->uz_fails = 0; A> zone->uz_sleeps = 0; A> zone->uz_count = 0; A> + zone->uz_count_min = 0; A> zone->uz_flags = 0; A> zone->uz_warning = NULL; A> timevalclear(&zone->uz_ratecheck); A> @@ -1552,6 +1560,7 @@ out: A> zone->uz_count = bucket_select(zone->uz_size); A> else A> zone->uz_count = BUCKET_MAX; A> + zone->uz_count_min = zone->uz_count; A> A> return (0); A> } A> A> Modified: head/sys/vm/uma_int.h A> ============================================================================== A> --- head/sys/vm/uma_int.h Tue Nov 19 09:35:20 2013 (r258335) A> +++ head/sys/vm/uma_int.h Tue Nov 19 10:05:53 2013 (r258336) A> @@ -300,7 +300,8 @@ struct uma_zone { A> volatile u_long uz_fails; /* Total number of alloc failures */ A> volatile u_long uz_frees; /* Total number of frees */ A> uint64_t uz_sleeps; /* Total number of alloc sleeps */ A> - uint16_t uz_count; /* Highest amount of items in bucket */ A> + uint16_t uz_count; /* Amount of items in full bucket */ A> + uint16_t uz_count_min; /* Minimal amount of items there */ A> A> /* The next three fields are used to print a rate-limited warnings. */ A> const char *uz_warning; /* Warning to print on failure */ -- Totus tuus, Glebius. _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"