linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
	"J. Bruce Fields" <bfields@fieldses.org>
Subject: [PATCH RFC 2/3] list_lru: add a new LRU_SKIP_REST lru_status value and handling
Date: Thu,  5 Dec 2013 06:00:52 -0500	[thread overview]
Message-ID: <1386241253-5781-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1386241253-5781-1-git-send-email-jlayton@redhat.com>

The current list_lru_walk_node implementation always walks the entire
list. In some cases, we can be sure that when an entry isn't freeable
that none of the rest of the entries on the list will be either.

Create a new LRU_SKIP_REST return value that not only indicates that
the current entry was skipped, but that caller should stop scanning
the current node.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 include/linux/list_lru.h | 2 ++
 mm/list_lru.c            | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index 3ce5417..6140c3a 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -15,6 +15,8 @@ enum lru_status {
 	LRU_REMOVED,		/* item removed from list */
 	LRU_ROTATE,		/* item referenced, give another pass */
 	LRU_SKIP,		/* item cannot be locked, skip */
+	LRU_SKIP_REST,		/* item isn't freeable, and none of the rest
+				   on the list will be either */
 	LRU_RETRY,		/* item not freeable. May drop the lock
 				   internally, but has to return locked. */
 };
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 72f9dec..abec7fb 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -98,6 +98,8 @@ restart:
 			break;
 		case LRU_SKIP:
 			break;
+		case LRU_SKIP_REST:
+			goto done;
 		case LRU_RETRY:
 			/*
 			 * The lru lock has been dropped, our list traversal is
@@ -108,7 +110,7 @@ restart:
 			BUG();
 		}
 	}
-
+done:
 	spin_unlock(&nlru->lock);
 	return isolated;
 }
-- 
1.8.4.2


  parent reply	other threads:[~2013-12-05 11:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 11:00 [PATCH RFC 0/3] nfsd: convert nfsd DRC code to use list_lru infrastructure Jeff Layton
2013-12-05 11:00 ` [PATCH RFC 1/3] nfsd: don't try to reuse an expired DRC entry off the list Jeff Layton
2013-12-05 13:29   ` Christoph Hellwig
2013-12-05 13:41     ` Jeff Layton
2013-12-05 15:50       ` J. Bruce Fields
2013-12-05 16:22         ` Jeff Layton
2013-12-05 11:00 ` Jeff Layton [this message]
2013-12-05 13:30   ` [PATCH RFC 2/3] list_lru: add a new LRU_SKIP_REST lru_status value and handling Christoph Hellwig
2013-12-05 13:36     ` Jeff Layton
2013-12-05 11:00 ` [PATCH RFC 3/3] nfsd: convert DRC code to use list_lru Jeff Layton
2013-12-05 13:41   ` Christoph Hellwig
2013-12-05 13:48     ` Jeff Layton
2013-12-05 15:58       ` J. Bruce Fields
2013-12-11 16:31         ` J. Bruce Fields
2013-12-05 13:27 ` [PATCH RFC 0/3] nfsd: convert nfsd DRC code to use list_lru infrastructure Christoph Hellwig
2013-12-05 13:37   ` Jeff Layton

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=1386241253-5781-3-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).