From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>, linux-mm@kvack.org
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mel Gorman <mel@csn.ul.ie>, Andy Whitcroft <apw@shadowen.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] lumpy cleanup a missplaced comment and simplify some code
Date: Wed, 6 Dec 2006 17:00:05 +0000 [thread overview]
Message-ID: <4f3dd33d974901c0c6dbf313d72ef7f9@pinky> (raw)
In-Reply-To: exportbomb.1165424343@pinky
Move the comment for isolate_lru_pages() back to its function
and comment the new function. Add some running commentry on the
area scan. Cleanup the indentation on switch to match the majority
view in mm/*. Finally, clarify the boundary pfn calculations.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0f2d961..0effa3e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -606,21 +606,14 @@ keep:
}
/*
- * zone->lru_lock is heavily contended. Some of the functions that
- * shrink the lists perform better by taking out a batch of pages
- * and working on them outside the LRU lock.
+ * Attempt to remove the specified page from its LRU. Only take this
+ * page if it is of the appropriate PageActive status. Pages which
+ * are being freed elsewhere are also ignored.
*
- * For pagecache intensive workloads, this function is the hottest
- * spot in the kernel (apart from copy_*_user functions).
- *
- * Appropriate locks must be held before calling this function.
+ * @page: page to consider
+ * @active: active/inactive flag only take pages of this type
*
- * @nr_to_scan: The number of pages to look through on the list.
- * @src: The LRU list to pull pages off.
- * @dst: The temp list to put pages on to.
- * @scanned: The number of pages that were scanned.
- *
- * returns how many pages were moved onto *@dst.
+ * returns 0 on success, -ve errno on failure.
*/
int __isolate_lru_page(struct page *page, int active)
{
@@ -642,6 +635,23 @@ int __isolate_lru_page(struct page *page, int active)
return ret;
}
+/*
+ * zone->lru_lock is heavily contended. Some of the functions that
+ * shrink the lists perform better by taking out a batch of pages
+ * and working on them outside the LRU lock.
+ *
+ * For pagecache intensive workloads, this function is the hottest
+ * spot in the kernel (apart from copy_*_user functions).
+ *
+ * Appropriate locks must be held before calling this function.
+ *
+ * @nr_to_scan: The number of pages to look through on the list.
+ * @src: The LRU list to pull pages off.
+ * @dst: The temp list to put pages on to.
+ * @scanned: The number of pages that were scanned.
+ *
+ * returns how many pages were moved onto *@dst.
+ */
static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
struct list_head *src, struct list_head *dst,
unsigned long *scanned, int order)
@@ -659,26 +669,31 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
active = PageActive(page);
switch (__isolate_lru_page(page, active)) {
- case 0:
- list_move(&page->lru, dst);
- nr_taken++;
- break;
+ case 0:
+ list_move(&page->lru, dst);
+ nr_taken++;
+ break;
- case -EBUSY:
- /* else it is being freed elsewhere */
- list_move(&page->lru, src);
- continue;
+ case -EBUSY:
+ /* else it is being freed elsewhere */
+ list_move(&page->lru, src);
+ continue;
- default:
- BUG();
+ default:
+ BUG();
}
if (!order)
continue;
- page_pfn = pfn = __page_to_pfn(page);
- end_pfn = pfn &= ~((1 << order) - 1);
- end_pfn += 1 << order;
+ /*
+ * Attempt to take all pages in the order aligned region
+ * surrounding the tag page. Only take those pages of
+ * the same active state as that tag page.
+ */
+ page_pfn = __page_to_pfn(page);
+ pfn = page_pfn & ~((1 << order) - 1);
+ end_pfn = pfn + (1 << order);
for (; pfn < end_pfn; pfn++) {
if (unlikely(pfn == page_pfn))
continue;
@@ -688,17 +703,16 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
scan++;
tmp = __pfn_to_page(pfn);
switch (__isolate_lru_page(tmp, active)) {
- case 0:
- list_move(&tmp->lru, dst);
- nr_taken++;
- continue;
-
- case -EBUSY:
- /* else it is being freed elsewhere */
- list_move(&tmp->lru, src);
- default:
- break;
+ case 0:
+ list_move(&tmp->lru, dst);
+ nr_taken++;
+ continue;
+ case -EBUSY:
+ /* else it is being freed elsewhere */
+ list_move(&tmp->lru, src);
+ default:
+ break;
}
break;
}
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-12-06 17:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 16:59 [PATCH 0/4] Lumpy Reclaim V3 Andy Whitcroft
2006-12-06 16:59 ` [PATCH 1/4] lumpy reclaim v2 Andy Whitcroft
2006-12-15 4:57 ` Andrew Morton
2007-01-26 11:00 ` Andrew Morton
2006-12-06 17:00 ` Andy Whitcroft [this message]
2006-12-06 17:00 ` [PATCH 3/4] lumpy ensure we respect zone boundaries Andy Whitcroft
2006-12-06 17:01 ` [PATCH 4/4] lumpy take the other active inactive pages in the area Andy Whitcroft
2006-12-11 23:29 ` [PATCH 0/4] Lumpy Reclaim V3 Andrew Morton
2007-01-29 12:24 ` Andy Whitcroft
2006-12-12 11:13 ` Andrew Morton
2006-12-12 13:14 ` Andy Whitcroft
2007-01-29 12:25 ` Andy Whitcroft
-- strict thread matches above, loose matches on Subject: below --
2006-11-23 16:48 Andy Whitcroft
2006-11-23 16:49 ` [PATCH 2/4] lumpy cleanup a missplaced comment and simplify some code Andy Whitcroft
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=4f3dd33d974901c0c6dbf313d72ef7f9@pinky \
--to=apw@shadowen.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
/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).