From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx135.postini.com [74.125.245.135]) by kanga.kvack.org (Postfix) with SMTP id B43966B0044 for ; Thu, 8 Nov 2012 17:40:45 -0500 (EST) Date: Thu, 8 Nov 2012 14:40:43 -0800 From: Andrew Morton Subject: Re: [PATCH v6 25/29] memcg/sl[au]b: shrink dead caches Message-Id: <20121108144043.baf9f2e5.akpm@linux-foundation.org> In-Reply-To: <509C32B4.7050105@parallels.com> References: <1351771665-11076-1-git-send-email-glommer@parallels.com> <1351771665-11076-26-git-send-email-glommer@parallels.com> <20121105164813.2eba5ecb.akpm@linux-foundation.org> <509A0A04.2030503@parallels.com> <20121106231627.3610c908.akpm@linux-foundation.org> <509A2849.9090509@parallels.com> <20121107144612.e822986f.akpm@linux-foundation.org> <0000013ae1050e6f-7f908e0b-720a-4e68-a275-e5086a4f5c74-000000@email.amazonses.com> <20121108112120.fc964c29.akpm@linux-foundation.org> <509C32B4.7050105@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Glauber Costa Cc: Christoph Lameter , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, Johannes Weiner , Tejun Heo , Michal Hocko , Pekka Enberg , David Rientjes , Pekka Enberg , Suleiman Souhlal , Robert Moore , Len Brown , "Brown, Len" On Thu, 8 Nov 2012 23:31:16 +0100 Glauber Costa wrote: > On 11/08/2012 08:21 PM, Andrew Morton wrote: > > On Thu, 8 Nov 2012 17:15:36 +0000 > > Christoph Lameter wrote: > > > >> On Wed, 7 Nov 2012, Andrew Morton wrote: > >> > >>> What's up with kmem_cache_shrink? It's global and exported to modules > >>> but its only external caller is some weird and hopelessly poorly > >>> documented site down in drivers/acpi/osl.c. slab and slob implement > >>> kmem_cache_shrink() *only* for acpi! wtf? Let's work out what acpi is > >>> trying to actually do there, then do it properly, then killkillkill! > >> > >> kmem_cache_shrink is also used internally. Its simply releasing unused > >> cached objects. > > > > Only in slub. It could be removed outright from the others and > > simplified in slub. > > > >>> Secondly, as slab and slub (at least) have the ability to shed cached > >>> memory, why aren't they hooked into the core cache-shinking machinery. > >>> After all, it's called "shrink_slab"! > >> > >> Because the core cache shrinking needs the slab caches to free up memory > >> from inodes and dentries. We could call kmem_cache_shrink at the end of > >> the shrink passes in vmscan. The price would be that the caches would have > >> to be repopulated when new allocations occur. > > > > Well, the shrinker shouldn't strips away all the cache. It will perform > > a partial trim, the magnitude of which increases with perceived > > external memory pressure. > > > > AFACIT, this is correct and desirable behaviour for shrinking > > slab's internal caches. > > > > I believe calling this from shrink_slab() is not a bad idea at all. If > you're all in favour, I'll cook a patch for this soon It sounds like a pretty big change but yes, well worth exploring. I'd still like to give ACPI a thwap. That kmem_cache_shrink() in drivers/acpi/osl.c was added unchangelogged in a megapatch (73459f73e5d1602c59) so it's a mystery. Cc's optimistically added. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org