From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, khlebnikov@openvz.org
Subject: Re: [PATCH 08/13] list: add a new LRU list type
Date: Tue, 23 Aug 2011 19:32:05 +1000 [thread overview]
Message-ID: <20110823093205.GZ3162@dastard> (raw)
In-Reply-To: <20110823092056.GE21492@infradead.org>
On Tue, Aug 23, 2011 at 05:20:56AM -0400, Christoph Hellwig wrote:
> On Tue, Aug 23, 2011 at 06:56:21PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > Several subsystems use the same construct for LRU lists - a list
> > head, a spin lock and and item count. They also use exactly the same
> > code for adding and removing items from the LRU. Create a generic
> > type for these LRU lists.
> >
> > This is the beginning of generic, node aware LRUs for shrinkers to
> > work with.
>
> Why list_lru vs the more natural sounding lru_list?
because the mmzone.h claimed that namespace:
enum lru_list {
LRU_INACTIVE_ANON = LRU_BASE,
LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
LRU_UNEVICTABLE,
NR_LRU_LISTS
};
and it is widely spewed through the mm code. I didn't really feel
like having to clean that mess up first....
> > diff --git a/lib/Makefile b/lib/Makefile
> > index d5d175c..a08212f 100644
> > --- a/lib/Makefile
> > +++ b/lib/Makefile
> > @@ -12,7 +12,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
> > idr.o int_sqrt.o extable.o prio_tree.o \
> > sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
> > proportions.o prio_heap.o ratelimit.o show_mem.o \
> > - is_single_threaded.o plist.o decompress.o find_next_bit.o
> > + is_single_threaded.o plist.o decompress.o find_next_bit.o \
> > + list_lru.o
>
> Di we finally fix the issues with lib-y objects beeing discarded despite
> modules relying on the exports?
Don't care. The list_lru code is used by the VFs, so it will always
be built in....
> > +int
> > +list_lru_add(
> > + struct list_lru *lru,
> > + struct list_head *item)
> > +{
>
> What about some kerneldoc comments for the helpers?
Yup, to be done.
>
> > + ret = isolate(item, &lru->lock, cb_arg);
> > + switch (ret) {
> > + case 0: /* item removed from list */
> > + lru->nr_items--;
> > + removed++;
> > + break;
> > + case 1: /* item referenced, give another pass */
> > + list_move_tail(item, &lru->list);
> > + break;
> > + case 2: /* item cannot be locked, skip */
> > + break;
> > + case 3: /* item not freeable, lock dropped */
> > + goto restart;
>
> I think the isolate callback returns shoud have symbolic names, i.e.
> and enum lru_isolate or similar.
Will do.
>
> > +int
> > +list_lru_init(
> > + struct list_lru *lru)
> > +{
> > + spin_lock_init(&lru->lock);
> > + INIT_LIST_HEAD(&lru->list);
> > + lru->nr_items = 0;
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(list_lru_init);
>
> This one doesn't need a return value.
No, not yet. I'll kill it.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
WARNING: multiple messages have this Message-ID (diff)
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, khlebnikov@openvz.org
Subject: Re: [PATCH 08/13] list: add a new LRU list type
Date: Tue, 23 Aug 2011 19:32:05 +1000 [thread overview]
Message-ID: <20110823093205.GZ3162@dastard> (raw)
In-Reply-To: <20110823092056.GE21492@infradead.org>
On Tue, Aug 23, 2011 at 05:20:56AM -0400, Christoph Hellwig wrote:
> On Tue, Aug 23, 2011 at 06:56:21PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > Several subsystems use the same construct for LRU lists - a list
> > head, a spin lock and and item count. They also use exactly the same
> > code for adding and removing items from the LRU. Create a generic
> > type for these LRU lists.
> >
> > This is the beginning of generic, node aware LRUs for shrinkers to
> > work with.
>
> Why list_lru vs the more natural sounding lru_list?
because the mmzone.h claimed that namespace:
enum lru_list {
LRU_INACTIVE_ANON = LRU_BASE,
LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
LRU_UNEVICTABLE,
NR_LRU_LISTS
};
and it is widely spewed through the mm code. I didn't really feel
like having to clean that mess up first....
> > diff --git a/lib/Makefile b/lib/Makefile
> > index d5d175c..a08212f 100644
> > --- a/lib/Makefile
> > +++ b/lib/Makefile
> > @@ -12,7 +12,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
> > idr.o int_sqrt.o extable.o prio_tree.o \
> > sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
> > proportions.o prio_heap.o ratelimit.o show_mem.o \
> > - is_single_threaded.o plist.o decompress.o find_next_bit.o
> > + is_single_threaded.o plist.o decompress.o find_next_bit.o \
> > + list_lru.o
>
> Di we finally fix the issues with lib-y objects beeing discarded despite
> modules relying on the exports?
Don't care. The list_lru code is used by the VFs, so it will always
be built in....
> > +int
> > +list_lru_add(
> > + struct list_lru *lru,
> > + struct list_head *item)
> > +{
>
> What about some kerneldoc comments for the helpers?
Yup, to be done.
>
> > + ret = isolate(item, &lru->lock, cb_arg);
> > + switch (ret) {
> > + case 0: /* item removed from list */
> > + lru->nr_items--;
> > + removed++;
> > + break;
> > + case 1: /* item referenced, give another pass */
> > + list_move_tail(item, &lru->list);
> > + break;
> > + case 2: /* item cannot be locked, skip */
> > + break;
> > + case 3: /* item not freeable, lock dropped */
> > + goto restart;
>
> I think the isolate callback returns shoud have symbolic names, i.e.
> and enum lru_isolate or similar.
Will do.
>
> > +int
> > +list_lru_init(
> > + struct list_lru *lru)
> > +{
> > + spin_lock_init(&lru->lock);
> > + INIT_LIST_HEAD(&lru->list);
> > + lru->nr_items = 0;
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(list_lru_init);
>
> This one doesn't need a return value.
No, not yet. I'll kill it.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-08-23 9:32 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 8:56 [PATCH 00/12] RFC: shrinker APi rework and generic LRU lists Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 8:56 ` [PATCH 01/13] fs: Use a common define for inode slab caches Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:13 ` Christoph Hellwig
2011-08-23 9:13 ` Christoph Hellwig
2011-08-23 9:20 ` Dave Chinner
2011-08-23 9:20 ` Dave Chinner
2011-08-24 6:16 ` Christoph Hellwig
2011-08-24 6:16 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 02/13] dcache: convert dentry_stat.nr_unused to per-cpu counters Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:13 ` Christoph Hellwig
2011-08-23 9:13 ` Christoph Hellwig
2011-08-24 14:12 ` Christoph Lameter
2011-08-24 14:12 ` Christoph Lameter
2011-08-23 8:56 ` [PATCH 03/13] dentry: move to per-sb LRU locks Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-24 6:16 ` Christoph Hellwig
2011-08-24 6:16 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 04/13] mm: new shrinker API Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:15 ` Christoph Hellwig
2011-08-23 9:15 ` Christoph Hellwig
2011-08-23 9:23 ` Dave Chinner
2011-08-23 9:23 ` Dave Chinner
2011-08-24 6:17 ` Christoph Hellwig
2011-08-24 6:17 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 05/13] mm: convert shrinkers to use new API Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:17 ` Christoph Hellwig
2011-08-23 9:17 ` Christoph Hellwig
2011-08-23 9:35 ` Steven Whitehouse
2011-08-23 9:35 ` Steven Whitehouse
2011-08-26 17:09 ` Wanlong Gao
2011-08-26 17:09 ` Wanlong Gao
2011-08-23 8:56 ` [PATCH 06/13] shrinker: remove old API now it is unused Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 8:56 ` [PATCH 07/13] Use atomic-long operations instead of looping around cmpxchg() Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 8:56 ` [PATCH 08/13] list: add a new LRU list type Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:20 ` Christoph Hellwig
2011-08-23 9:20 ` Christoph Hellwig
2011-08-23 9:32 ` Dave Chinner [this message]
2011-08-23 9:32 ` Dave Chinner
2011-08-23 9:58 ` Konstantin Khlebnikov
2011-08-23 9:58 ` Konstantin Khlebnikov
2011-08-24 14:24 ` Christoph Lameter
2011-08-24 14:24 ` Christoph Lameter
2011-08-23 8:56 ` [PATCH 09/13] inode: convert inode lru list to generic lru list code Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-24 6:38 ` Christoph Hellwig
2011-08-24 6:38 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 10/13] xfs: convert buftarg LRU to generic code Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-24 6:27 ` Christoph Hellwig
2011-08-24 6:27 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 11/13] dcache: use a dispose list in select_parent Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:37 ` Christoph Hellwig
2011-08-23 9:37 ` Christoph Hellwig
2011-09-05 9:42 ` Christoph Hellwig
2011-09-05 9:42 ` Christoph Hellwig
2011-08-23 8:56 ` [PATCH 12/13] dcache: remove dentries from LRU before putting on dispose list Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-23 9:35 ` Christoph Hellwig
2011-08-23 9:35 ` Christoph Hellwig
2011-08-23 9:57 ` Dave Chinner
2011-08-23 9:57 ` Dave Chinner
2011-08-23 8:56 ` [PATCH 13/13] dcache: convert to use new lru list infrastructure Dave Chinner
2011-08-23 8:56 ` Dave Chinner
2011-08-24 6:32 ` Christoph Hellwig
2011-08-24 6:32 ` Christoph Hellwig
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=20110823093205.GZ3162@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=khlebnikov@openvz.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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.