On Mon, 2016-08-29 at 17:44 -0700, Aruna Ramakrishna wrote: > This patch optimizes 'cat /proc/slabinfo' by maintaining a counter for > total number of allocated slabs per node, per cache. [] > We tested this after > growing the dentry cache to 70GB, and the performance improved from 2s to > 5ms. Seems sensible, thanks. One completely trivial note: > diff --git a/mm/slab.c b/mm/slab.c [] > @@ -1394,24 +1395,27 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid) > for_each_kmem_cache_node(cachep, node, n) { > unsigned long active_objs = 0, num_objs = 0, free_objects = 0; > unsigned long active_slabs = 0, num_slabs = 0; > + unsigned long num_slabs_partial = 0, num_slabs_free = 0; > + unsigned long num_slabs_full; [] > + num_slabs_full = num_slabs - > + (num_slabs_partial + num_slabs_free); vs > @@ -4111,6 +4119,8 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo) > unsigned long num_objs; > unsigned long active_slabs = 0; > unsigned long num_slabs, free_objects = 0, shared_avail = 0; > + unsigned long num_slabs_partial = 0, num_slabs_free = 0; > + unsigned long num_slabs_full = 0; [] > + num_slabs_full = num_slabs - (num_slabs_partial + num_slabs_free); It seems odd to have different initialization styles for num_slabs_full. It seems the second one doesn't need to be initialized. It'd also be nicer I think if the two declarations blocks had more similar layouts. Maybe in a follow-on patch. Or not. Your choice. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>