All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>
To: Pekka Enberg <penberg-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Andrea Arcangeli
	<aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Rik van Riel <riel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Nick Piggin <npiggin-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	Eric Dumazet
	<eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	"containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	James Bottomley
	<jbottomley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
	Dave Hansen
	<dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [PATCH v3 3/4] limit nr_dentries per superblock
Date: Tue, 16 Aug 2011 12:11:54 +1000	[thread overview]
Message-ID: <20110816021154.GI26978__10798.9780408845$1313460947$gmane$org@dastard> (raw)
In-Reply-To: <CAOJsxLFjZffC9i5kQsBWjGy3eWdj3VMB5awz=yPcwgeKb5BG0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Mon, Aug 15, 2011 at 02:14:39PM +0300, Pekka Enberg wrote:
> Hi Pavel,
> 
> On Mon, Aug 15, 2011 at 2:05 PM, Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> wrote:
> > This will make sense, since the kernel memory management per-cgroup is one of the
> > things we'd live to have, but this particular idea will definitely not work in case
> > we keep the containers' files on one partition keeping each container in its own
> > chroot environment.
> 
> And you want a per-container dcache limit? Will the containers share
> the same superblock?

Yes, and that's one of the problems with the "arbitrary container"
approach to controlling the dentry cache size. Arbitrary containers
don't map easily to predictable and scalable LRU and reclaim
implementations. Hence right now the container scope is limited to
per-superblock.

> Couldn't you simply do per-container "struct
> kmem_accounted_cache" in struct superblock?

Probably could do it that way, but it's still not really and
integrated solution. What we'll end up with is this LRU structure:

struct lru_node {
	struct list_head		lru;
	spinlock_t			lock;
	long				nr_items;
} ____cacheline_aligned_in_smp;

struct lru {
	struct kmem_accounted_cache	*cache;
	struct lru_node			lru_node[MAX_NUMNODES];
	nodemask_t			active_nodes;
	int (*isolate_item)(struct list_head *item);
	int (*dispose)(struct list_head *list);
}

Where the only thing that the lru->cache is used for is getting the
number of items allocated to the cache. Seems relatively pointless
to make that statistic abstraction for just a single value that we
can get via a simple per-cpu counter...

Then, when you consider SLUB has this structure for every individual
slab cache:

struct kmem_cache_node {
        spinlock_t list_lock;   /* Protect partial list and nr_partial */
        unsigned long nr_partial;
        struct list_head partial;
#ifdef CONFIG_SLUB_DEBUG
        atomic_long_t nr_slabs;
        atomic_long_t total_objects;
        struct list_head full;
#endif
};

you can see why tight integration of the per-node LRU infrastructure
is appealing - there's no unnecessary duplication and the accounting
is done in the right spot. It also means there is only one shrinker
implmentation for all slabs, with a couple of simple per-slab
callbacks for isolating objects for disposal and then to dispose of
them. This would mean that most slab caches that use shrinkers would
no longer need to implement their own LRU, get LRU scalability and
node-aware reclaim for free, have built in size limits, etc.

And FWIW, integrating the LRU shrinker mechanism into the slab cache
also provides the mechanisms needed for capping the size of the
cache as well as slab defragmentation.  Much smarter things can be
done when you know both the age and the locality of objects. e.g.
there's no point preventing allocation from a slab due to maximum
object count limitations if there are partial pages in the slab
cache because the allocation can be done without increasing memory
footprint.....

Cheers,

Dave.
-- 
Dave Chinner
david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

  parent reply	other threads:[~2011-08-16  2:11 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 15:13 [PATCH v3 0/4] Per-container dcache limitation Glauber Costa
2011-08-14 15:13 ` Glauber Costa
     [not found] ` <1313334832-1150-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-14 15:13   ` [PATCH v3 1/4] factor out single-shrinker code Glauber Costa
2011-08-14 15:13     ` Glauber Costa
2011-08-15  6:43     ` Dave Chinner
     [not found]     ` <1313334832-1150-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-15  6:43       ` Dave Chinner
2011-08-14 15:13   ` [PATCH v3 2/4] Keep nr_dentry per super block Glauber Costa
2011-08-14 15:13     ` Glauber Costa
2011-08-14 17:38     ` Eric Dumazet
2011-08-14 17:38       ` Eric Dumazet
     [not found]     ` <1313334832-1150-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-14 17:38       ` Eric Dumazet
2011-08-14 15:13   ` [PATCH v3 3/4] limit nr_dentries per superblock Glauber Costa
2011-08-14 15:13     ` Glauber Costa
     [not found]     ` <1313334832-1150-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-15  7:03       ` Dave Chinner
2011-08-15  7:12       ` Pekka Enberg
2011-08-15  7:03     ` Dave Chinner
2011-08-15  7:12     ` Pekka Enberg
     [not found]       ` <CAOJsxLFYD9DkEU5R+9fZr-uaznteP8-BUC_Ti+FnNFqtbOCHSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-15 10:46         ` Dave Chinner
2011-08-15 10:46       ` Dave Chinner
2011-08-15 10:58         ` Pekka Enberg
     [not found]           ` <CAOJsxLGFJmqO-W=itQbO4Mh4DxSD4wrHOC8gQ5bWL5aE1YYeQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-15 11:05             ` Pavel Emelyanov
2011-08-15 11:05           ` Pavel Emelyanov
2011-08-15 11:05             ` Pavel Emelyanov
2011-08-15 11:14             ` Pekka Enberg
2011-08-15 11:14               ` Pekka Enberg
2011-08-15 11:32               ` Pavel Emelyanov
2011-08-15 11:32                 ` Pavel Emelyanov
2011-08-15 11:55                 ` Pekka Enberg
2011-08-15 11:55                   ` Pekka Enberg
2011-08-15 12:12                   ` Pavel Emelyanov
2011-08-15 12:12                     ` Pavel Emelyanov
2011-08-15 12:23                     ` Pekka Enberg
2011-08-15 12:23                       ` Pekka Enberg
2011-08-15 12:37                       ` Pavel Emelyanov
2011-08-15 12:37                         ` Pavel Emelyanov
     [not found]                       ` <CAOJsxLEVfGrzUQv0fOpOyw3AaOLOHcWbvLJL1NdrHS6M2j5o1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-15 12:37                         ` Pavel Emelyanov
     [not found]                     ` <4E490D47.8050105-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-15 12:23                       ` Pekka Enberg
     [not found]                   ` <CAOJsxLErFcxuuqnWkRbOAHEFbeGrKp3YMZ-144=m16oBXCHJ2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-15 12:12                     ` Pavel Emelyanov
     [not found]                 ` <4E4903C1.9050207-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-15 11:55                   ` Pekka Enberg
     [not found]               ` <CAOJsxLFjZffC9i5kQsBWjGy3eWdj3VMB5awz=yPcwgeKb5BG0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-15 11:32                 ` Pavel Emelyanov
2011-08-16  2:11                 ` Dave Chinner [this message]
2011-08-16  2:11               ` Dave Chinner
2011-08-16  2:11                 ` Dave Chinner
     [not found]             ` <4E48FD8A.90401-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-15 11:14               ` Pekka Enberg
2011-08-15 10:58         ` Pekka Enberg
2011-08-14 15:13   ` [PATCH v3 4/4] parse options in the vfs level Glauber Costa
2011-08-14 15:13     ` Glauber Costa
2011-08-14 15:39     ` Vasiliy Kulikov
2011-08-15  0:03       ` Glauber Costa
2011-08-15  0:03       ` Glauber Costa
     [not found]     ` <1313334832-1150-5-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-14 15:39       ` Vasiliy Kulikov
2011-08-15  7:09       ` Dave Chinner
2011-08-15  7:09     ` Dave Chinner
2011-08-24  2:19       ` Glauber Costa
2011-08-24  2:19       ` Glauber Costa
2011-08-17  5:43   ` [PATCH v3 0/4] Per-container dcache limitation Dave Chinner
2011-08-17  5:43 ` Dave Chinner
2011-08-17 18:44   ` Glauber Costa
2011-08-17 18:44   ` Glauber Costa
2011-08-18  1:27     ` Dave Chinner
2011-08-18  1:27       ` Dave Chinner
2011-08-22 11:42       ` Glauber Costa
2011-08-22 11:42       ` Glauber Costa
2011-08-22 11:42         ` Glauber Costa
     [not found]     ` <4E4C0C25.3-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-08-18  1:27       ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20110816021154.GI26978__10798.9780408845$1313460947$gmane$org@dastard' \
    --to=david-fqsqvqoi3ljby3ivrkzq2a@public.gmane.org \
    --cc=aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jbottomley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=npiggin-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=penberg-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=riel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.