Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2194598ybd; Thu, 27 Jun 2019 08:17:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6NNVJfbHfMwMNcoSwPHC/dw08kBFmtdZtTg0FVL+R1UEKZkzNn0bWU7QgD0Rrrg1PhLnH X-Received: by 2002:a17:902:70cc:: with SMTP id l12mr5312078plt.87.1561648649904; Thu, 27 Jun 2019 08:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561648649; cv=none; d=google.com; s=arc-20160816; b=VBARzak6fm1/xogwHwr+xkJNNqyRsq0pDwhmjiiioIPsCd4Km+riZw5rmpP03g6x/U m0ZpWChiiNrYydk2HiCQ3MhBPD2b21v41RhcCSqX38bl4hY1ah7BIl+jGHmUTINKFu1P 3gLyM8FZg7AniE7diTJEKqd4IfOsgrbYRkJAj0o/HrOtjnjsYHYSJC7zlJ7CI7vrPaUQ 40AcJ66gdUIgcXz0TPPyX2ACYKdNP4pHVrnAq/dKlie9Yjl14LvHtqbG54+8VVncJsMQ zGIBGzoWALzEZ2XB7SHKiHWKV+5JI2CfQKxWigkdBUc7rMEHyyGM4vRyTpEcZ6hw8HB5 Rebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7OR3WboDdjwMiZvKMKTbKP7KeumlfsgbRe9s5up+hVc=; b=tBgI6DrWCr19LZL5dVd7oOJ2NWzghVENjuKSUwkUhjmkYGVOGgLZOKz6pF8eG8dJEd EQTe5UR3nW9BZdRIrRZ0LOyPCCab7syB7It3DI+2Xoy+Mn7IRvrtdQSlI7i85zUUTYN/ Zeudl25LKSOsoRWuecYbrwJmkSPQzDukJWK+agtXKgd0HwbMak+4wtVjPjgbn/xXH2mS Q6lqbeCnvCggvr7s204+GqFJrBVGqUv6Q97s+TiWGdP+0vUM5YVXJ782f6f9XjXVBeT8 9hbpr8ZR+qlOeMX1EdfMSY6Qu2fbXD0IbSWgEKqZrcIm34dW1P6cKu+oUPrxNqLJ7MOL 9euA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p62si5379859pjp.66.2019.06.27.08.17.12; Thu, 27 Jun 2019 08:17:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbfF0PPK (ORCPT + 99 others); Thu, 27 Jun 2019 11:15:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:43548 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726384AbfF0PPK (ORCPT ); Thu, 27 Jun 2019 11:15:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A290BABC4; Thu, 27 Jun 2019 15:15:08 +0000 (UTC) Date: Thu, 27 Jun 2019 17:15:06 +0200 From: Michal Hocko To: Waiman Long Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Alexander Viro , Jonathan Corbet , Luis Chamberlain , Kees Cook , Johannes Weiner , Vladimir Davydov , linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Roman Gushchin , Shakeel Butt , Andrea Arcangeli Subject: Re: [PATCH 2/2] mm, slab: Extend vm/drop_caches to shrink kmem slabs Message-ID: <20190627151506.GE5303@dhcp22.suse.cz> References: <20190624174219.25513-1-longman@redhat.com> <20190624174219.25513-3-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190624174219.25513-3-longman@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 24-06-19 13:42:19, Waiman Long wrote: > With the slub memory allocator, the numbers of active slab objects > reported in /proc/slabinfo are not real because they include objects > that are held by the per-cpu slab structures whether they are actually > used or not. The problem gets worse the more CPUs a system have. For > instance, looking at the reported number of active task_struct objects, > one will wonder where all the missing tasks gone. > > I know it is hard and costly to get a real count of active objects. What exactly is expensive? Why cannot slabinfo reduce the number of active objects by per-cpu cached objects? > So > I am not advocating for that. Instead, this patch extends the > /proc/sys/vm/drop_caches sysctl parameter by using a new bit (bit 3) > to shrink all the kmem slabs which will flush out all the slabs in the > per-cpu structures and give a more accurate view of how much memory are > really used up by the active slab objects. This is a costly operation, > of course, but it gives a way to have a clearer picture of the actual > number of slab objects used, if the need arises. drop_caches is a terrible interface. It destroys all the caching and people are just too easy in using it to solve any kind of problem they think they might have and cause others they might not see immediately. I am strongly discouraging anybody - except for some tests which really do want to see reproducible results without cache effects - from using this interface and therefore I am not really happy to paper over something that might be a real problem with yet another mode. If SLUB indeed caches too aggressively on large machines then this should be fixed. -- Michal Hocko SUSE Labs