From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Chen Subject: Re: [RFC, PATCH] Make memory reclaim from inodes and dentry cache more scalable Date: Tue, 08 May 2012 13:00:09 -0700 Message-ID: <1336507209.3796.90.camel@schen9-DESK> References: <1335996382.3796.88.camel@schen9-DESK> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Kleen To: Alexander Viro Return-path: Received: from mga09.intel.com ([134.134.136.24]:50550 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756781Ab2EHUAI (ORCPT ); Tue, 8 May 2012 16:00:08 -0400 In-Reply-To: <1335996382.3796.88.camel@schen9-DESK> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 2012-05-02 at 15:06 -0700, Tim Chen wrote: > The following patch detects when inodes and dentries cache are really > low in free entries, and skip reclamation of memory from them when it is > futile to do so. We only resume reclaiming memory from inodes and > dentries cache when we have a reasonable amount of memory there. > This avoided us bottlenecking on sb_lock to do useless memory > reclamation. > > I assume that it is okay to check super block's number of free objects > content without sb_lock as we are holding shrinker list's read lock. The > shrinker is still registered so super block is not yet deactivated which > requires shrinker un-registration. It will be great if Al can help to > comment on whether this assumption is okay. > > In a test scenario where page cache is putting heavy pressure on memory > usage with large number of processes, we saw very heavy contention on > the sb_lock to get free pages as seen in the following profile. The > patch helped to reduce the runtime by almost a factor of 4. > > 62.81% cp [kernel.kallsyms] [k] _raw_spin_lock > | > --- _raw_spin_lock > | > |--45.19%-- grab_super_passive > | prune_super > | shrink_slab > | do_try_to_free_pages > | try_to_free_pages > | __alloc_pages_nodemask > | alloc_pages_current > > > Tim Hi Al, Want to ping you again to see what your thoughts are on this patch I've sent a week ago. Thanks. Tim