From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Lameter Subject: Re: SLUB defrag pull request? Date: Tue, 21 Oct 2008 18:17:26 -0500 Message-ID: <48FE6306.6020806@linux-foundation.org> References: <1223883004.31587.15.camel@penberg-laptop> <1223883164.31587.16.camel@penberg-laptop> <200810132354.30789.nickpiggin@yahoo.com.au> <48F378C6.7030206@linux-foundation.org> <48FC9CCC.3040006@linux-foundation.org> <48FCCC72.5020202@linux-foundation.org> <48FCD7CB.4060505@linux-foundation.org> <48FCE1C4.20807@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: penberg@cs.helsinki.fi, nickpiggin@yahoo.com.au, hugh@veritas.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org To: Miklos Szeredi Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:41125 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbYJUXSD (ORCPT ); Tue, 21 Oct 2008 19:18:03 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Miklos Szeredi wrote: > On Mon, 20 Oct 2008, Christoph Lameter wrote: >> Miklos Szeredi wrote: >>> So, isn't it possible to do without get_dentries()? What's the >>> fundamental difference between this and regular cache shrinking? >> The fundamental difference is that slab defrag operates on sparsely >> populated dentries. It comes into effect when the density of >> dentries per page is low and lots of memory is wasted. It >> defragments by kicking out dentries in low density pages. These can >> then be reclaimed. > > OK, but why can't this be done in just one stage? The only way that a secure reference can be established is if the slab page is locked. That requires a spinlock. The slab allocator calls the get() functions while the slab lock guarantees object existence. Then locks are dropped and reclaim actions can start with the guarantee that the slab object will not suddenly vanish.