From: Nick Piggin <piggin@cyberone.com.au>
To: linux-kernel <linux-kernel@vger.kernel.org>,
Linux Memory Management <linux-mm@kvack.org>
Subject: [RFC][PATCH 1/4] vm-lrutopage-cleanup
Date: Tue, 09 Mar 2004 16:33:01 +1100 [thread overview]
Message-ID: <404D570D.90608@cyberone.com.au> (raw)
In-Reply-To: <404D56D8.2000008@cyberone.com.au>
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: vm-lrutopage-cleanup.patch --]
[-- Type: text/x-patch, Size: 3369 bytes --]
Cleanup from Nikita's dont-rotate-active-list patch.
linux-2.6-npiggin/mm/vmscan.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff -puN mm/vmscan.c~vm-lrutopage-cleanup mm/vmscan.c
--- linux-2.6/mm/vmscan.c~vm-lrutopage-cleanup 2004-03-09 13:51:29.000000000 +1100
+++ linux-2.6-npiggin/mm/vmscan.c 2004-03-09 16:31:28.000000000 +1100
@@ -45,14 +45,15 @@
int vm_swappiness = 60;
static long total_memory;
+#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
+
#ifdef ARCH_HAS_PREFETCH
#define prefetch_prev_lru_page(_page, _base, _field) \
do { \
if ((_page)->lru.prev != _base) { \
struct page *prev; \
\
- prev = list_entry(_page->lru.prev, \
- struct page, lru); \
+ prev = lru_to_page(&(_page->lru)); \
prefetch(&prev->_field); \
} \
} while (0)
@@ -66,8 +67,7 @@ static long total_memory;
if ((_page)->lru.prev != _base) { \
struct page *prev; \
\
- prev = list_entry(_page->lru.prev, \
- struct page, lru); \
+ prev = lru_to_page(&(_page->lru)); \
prefetchw(&prev->_field); \
} \
} while (0)
@@ -262,7 +262,7 @@ shrink_list(struct list_head *page_list,
int may_enter_fs;
int referenced;
- page = list_entry(page_list->prev, struct page, lru);
+ page = lru_to_page(page_list);
list_del(&page->lru);
if (TestSetPageLocked(page))
@@ -496,8 +496,7 @@ shrink_cache(struct zone *zone, unsigned
while (nr_scan++ < SWAP_CLUSTER_MAX &&
!list_empty(&zone->inactive_list)) {
- page = list_entry(zone->inactive_list.prev,
- struct page, lru);
+ page = lru_to_page(&zone->inactive_list);
prefetchw_prev_lru_page(page,
&zone->inactive_list, flags);
@@ -542,7 +541,7 @@ shrink_cache(struct zone *zone, unsigned
* Put back any unfreeable pages.
*/
while (!list_empty(&page_list)) {
- page = list_entry(page_list.prev, struct page, lru);
+ page = lru_to_page(&page_list);
if (TestSetPageLRU(page))
BUG();
list_del(&page->lru);
@@ -601,7 +600,7 @@ refill_inactive_zone(struct zone *zone,
pgmoved = 0;
spin_lock_irq(&zone->lru_lock);
while (nr_pages && !list_empty(&zone->active_list)) {
- page = list_entry(zone->active_list.prev, struct page, lru);
+ page = lru_to_page(&zone->active_list);
prefetchw_prev_lru_page(page, &zone->active_list, flags);
if (!TestClearPageLRU(page))
BUG();
@@ -652,7 +651,7 @@ refill_inactive_zone(struct zone *zone,
reclaim_mapped = 1;
while (!list_empty(&l_hold)) {
- page = list_entry(l_hold.prev, struct page, lru);
+ page = lru_to_page(&l_hold);
list_del(&page->lru);
if (page_mapped(page)) {
if (!reclaim_mapped) {
@@ -683,7 +682,7 @@ refill_inactive_zone(struct zone *zone,
pgmoved = 0;
spin_lock_irq(&zone->lru_lock);
while (!list_empty(&l_inactive)) {
- page = list_entry(l_inactive.prev, struct page, lru);
+ page = lru_to_page(&l_inactive);
prefetchw_prev_lru_page(page, &l_inactive, flags);
if (TestSetPageLRU(page))
BUG();
@@ -712,7 +711,7 @@ refill_inactive_zone(struct zone *zone,
pgmoved = 0;
while (!list_empty(&l_active)) {
- page = list_entry(l_active.prev, struct page, lru);
+ page = lru_to_page(&l_active);
prefetchw_prev_lru_page(page, &l_active, flags);
if (TestSetPageLRU(page))
BUG();
_
next prev parent reply other threads:[~2004-03-09 5:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-09 5:32 [RFC][PATCH 0/4] VM split active lists Nick Piggin
2004-03-09 5:32 ` Nick Piggin
2004-03-09 5:33 ` Nick Piggin [this message]
2004-03-09 5:33 ` [RFC][PATCH 2/4] vm-nofixed-active-list Nick Piggin
2004-03-09 5:34 ` [RFC][PATCH 3/4] vm-no-reclaim_mapped Nick Piggin
2004-03-09 5:35 ` [RFC][PATCH 4/4] vm-mapped-x-active-lists Nick Piggin
2004-03-09 5:39 ` Nick Piggin
2004-03-09 5:39 ` Nick Piggin
2004-03-09 5:47 ` Mike Fedyk
2004-03-09 5:47 ` Mike Fedyk
2004-03-09 6:06 ` Nick Piggin
2004-03-09 6:06 ` Nick Piggin
2004-03-09 7:02 ` William Lee Irwin III
2004-03-09 7:02 ` William Lee Irwin III
2004-03-09 7:23 ` Nick Piggin
2004-03-09 7:23 ` Nick Piggin
2004-03-09 7:37 ` William Lee Irwin III
2004-03-09 7:37 ` William Lee Irwin III
2004-03-09 9:24 ` William Lee Irwin III
2004-03-09 9:24 ` William Lee Irwin III
2004-03-09 15:26 ` Marc-Christian Petersen
2004-03-09 15:42 ` Nikita Danilov
2004-03-09 15:42 ` Nikita Danilov
2004-03-10 2:49 ` Nick Piggin
2004-03-10 2:49 ` Nick Piggin
2004-03-10 5:10 ` [RFC][PATCH 0/4] VM split active lists Nick Piggin
2004-03-10 5:10 ` Nick Piggin
2004-03-12 9:58 ` Hans Reiser
2004-03-12 9:58 ` Hans Reiser
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=404D570D.90608@cyberone.com.au \
--to=piggin@cyberone.com.au \
--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.