Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8877694ybi; Tue, 23 Jul 2019 17:14:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzh5kb19RwdfKLAxAH0PQLs5xqveFKEq6Og4axSdkecDvxczxAjjb2xHzvbIl0qo/k66rE X-Received: by 2002:a17:902:24c:: with SMTP id 70mr82328459plc.2.1563927252884; Tue, 23 Jul 2019 17:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563927252; cv=none; d=google.com; s=arc-20160816; b=lH/CBqGowq4tdGtZV4wcIZvePCje4EZOe3QkLSywM9ebbDm78PiUmpmFBYlOhXH803 qQrbYy+HD9MBRx8iO3l+OGAWuGCl+s+GSb8CsXhfA8NMGMt6qsR0nsVCLynGN1BjNe62 cC3v4BW7HL/X0DtQxrR7BZlcIHYBS2kxASouXasryRFbjLmaJiKq3ULfjRMwEkDQmfMo s7lJXmfiGsIRxuJ978XayreDFwZZ59p2TK8MpkzRWTSVTeiarggR6+ttJk3WW6brn8kf jZH9Y56lzUed5Azt66abUm6nYSKhaKc6OEeb4fzwh9nMEgX38JWZyEeqFFnrsZunDEa2 2aCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=p6pI8ZVBikqtSstA53p+RN3PZUNckGvqGuKPrkWSdM8=; b=M8s4vurlsvZvgemamu1M6NJQ05lwhWgq8aX+C4hlrFUapNw/2NqLpagaQm5ZIFA6N5 1yQ5BeIDKnwLTllyC365MyhOwfmteVV5EkSoFlx/czJlIeeVWFJ8MCqnfvYfNb0uaeJe w51dTFVsgzxCGMpfuGK9kKRrQDBCU0vKWCeqhWCdc2nVQkIerU8VaddOxgcOncyfSGAr 6MMkH3qOF3L2wejMFo7QbXFcfFgvYiI3jBpRdtKVrH1QoDAbEai17052i0rLi7MP0yBv 5fJI2cdGdcl9Jig/JBcaV2QZ3JxRNOWknBjJ082Ka5XSufuBtMkY/rOQByvziyFoROSy +C4g== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si13948201pfn.202.2019.07.23.17.13.52; Tue, 23 Jul 2019 17:14:12 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390252AbfGWOaN (ORCPT + 99 others); Tue, 23 Jul 2019 10:30:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731652AbfGWOaM (ORCPT ); Tue, 23 Jul 2019 10:30:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3914781F18; Tue, 23 Jul 2019 14:30:11 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-160.bos.redhat.com [10.18.17.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1EBAC600D1; Tue, 23 Jul 2019 14:30:08 +0000 (UTC) Subject: Re: [PATCH] mm, slab: Extend slab/shrink to shrink all the memcg caches To: peter enderborg , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Alexander Viro , Jonathan Corbet , Luis Chamberlain , Kees Cook , Johannes Weiner , Michal Hocko , Vladimir Davydov Cc: 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 References: <20190702183730.14461-1-longman@redhat.com> <71ab6307-9484-fdd3-fe6d-d261acf7c4a5@sony.com> From: Waiman Long Organization: Red Hat Message-ID: Date: Tue, 23 Jul 2019 10:30:07 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <71ab6307-9484-fdd3-fe6d-d261acf7c4a5@sony.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 23 Jul 2019 14:30:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/22/19 8:46 AM, peter enderborg wrote: > On 7/2/19 8:37 PM, Waiman Long wrote: >> Currently, a value of '1" is written to /sys/kernel/slab//shrink >> file to shrink the slab by flushing all the per-cpu slabs and free >> slabs in partial lists. This applies only to the root caches, though. >> >> Extends this capability by shrinking all the child memcg caches and >> the root cache when a value of '2' is written to the shrink sysfs file. >> >> On a 4-socket 112-core 224-thread x86-64 system after a parallel kernel >> build, the the amount of memory occupied by slabs before shrinking >> slabs were: >> >> # grep task_struct /proc/slabinfo >> task_struct 7114 7296 7744 4 8 : tunables 0 0 >> 0 : slabdata 1824 1824 0 >> # grep "^S[lRU]" /proc/meminfo >> Slab: 1310444 kB >> SReclaimable: 377604 kB >> SUnreclaim: 932840 kB >> >> After shrinking slabs: >> >> # grep "^S[lRU]" /proc/meminfo >> Slab: 695652 kB >> SReclaimable: 322796 kB >> SUnreclaim: 372856 kB >> # grep task_struct /proc/slabinfo >> task_struct 2262 2572 7744 4 8 : tunables 0 0 >> 0 : slabdata 643 643 0 > > What is the time between this measurement points? Should not the shrinked memory show up as reclaimable? In this case, I echoed '2' to all the shrink sysfs files under /sys/kernel/slab. The purpose of shrinking caches is to reclaim as much unused memory slabs from all the caches, irrespective if they are reclaimable or not. We do not reclaim any used objects. That is why we see the numbers were reduced in both cases. Cheers, Longman