From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978AbcF2Kej (ORCPT ); Wed, 29 Jun 2016 06:34:39 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36114 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751604AbcF2Keh (ORCPT ); Wed, 29 Jun 2016 06:34:37 -0400 To: Christoph Lameter Cc: "Linux-Kernel@Vger. Kernel. Org" From: Nikolay Borisov Subject: Unbounded growth of slab caches and how to shrink them Message-ID: <5773A427.2080100@kyup.com> Date: Wed, 29 Jun 2016 13:34:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Christoph, I've observed a rather strange unbounded growth of the kmalloc-192 slab cache: OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME 711124869 411527215 3% 0.19K 16934908 42 135479264K kmalloc-192 Essentially the kmalloc is around 130 GB , yet only 3 percent of this are being used. In this case I'd like to essentially shrink the overall size of the cache. How is it possible to achieve that? I tried echoing '1' to /sys/kernel/slab/kmalloc-192/shrink but nothing changed. This is on 3.12 which is rather old kernel, but still I believe it is entirely possible for someone to find a way to flood a machine with network requests which would cause a lot of objects to be allocate, resulting in a particular slab cache growing, then later when the request flood stops the cache would be almost empty, yet the memory won't be usable for anything other than satisfying memory allocation from this cache. Regards, Nikolay