From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch 8/21] batched LRU movement of written back pages
Date: Sun, 11 Aug 2002 00:39:02 -0700 [thread overview]
Message-ID: <3D561496.66498087@zip.com.au> (raw)
Makes mpage_writepages() move pages around on the LRU sixteen-at-a-time
rather than one-at-a-time.
mpage.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
--- 2.5.31/fs/mpage.c~mpage_writepages-batch Sun Aug 11 00:20:33 2002
+++ 2.5.31-akpm/fs/mpage.c Sun Aug 11 00:21:02 2002
@@ -19,6 +19,7 @@
#include <linux/highmem.h>
#include <linux/prefetch.h>
#include <linux/mpage.h>
+#include <linux/pagevec.h>
/*
* The largest-sized BIO which this code will assemble, in bytes. Set this
@@ -522,12 +523,14 @@ mpage_writepages(struct address_space *m
sector_t last_block_in_bio = 0;
int ret = 0;
int done = 0;
+ struct pagevec pvec;
int (*writepage)(struct page *);
writepage = NULL;
if (get_block == NULL)
writepage = mapping->a_ops->writepage;
+ pagevec_init(&pvec);
write_lock(&mapping->page_lock);
list_splice_init(&mapping->dirty_pages, &mapping->io_pages);
@@ -557,29 +560,25 @@ mpage_writepages(struct address_space *m
if (page->mapping && !PageWriteback(page) &&
TestClearPageDirty(page)) {
- /* FIXME: batch this up */
- if (!PageActive(page) && PageLRU(page)) {
- spin_lock(&pagemap_lru_lock);
- if (!PageActive(page) && PageLRU(page)) {
- list_del(&page->lru);
- list_add(&page->lru, &inactive_list);
- }
- spin_unlock(&pagemap_lru_lock);
- }
-
if (writepage) {
ret = (*writepage)(page);
} else {
bio = mpage_writepage(bio, page, get_block,
&last_block_in_bio, &ret);
}
+ if (!PageActive(page) && PageLRU(page)) {
+ if (!pagevec_add(&pvec, page))
+ pagevec_deactivate_inactive(&pvec);
+ page = NULL;
+ }
if (ret || (nr_to_write && --(*nr_to_write) <= 0))
done = 1;
} else {
unlock_page(page);
}
- page_cache_release(page);
+ if (page)
+ page_cache_release(page);
write_lock(&mapping->page_lock);
}
/*
@@ -587,6 +586,7 @@ mpage_writepages(struct address_space *m
*/
list_splice_init(&mapping->io_pages, mapping->dirty_pages.prev);
write_unlock(&mapping->page_lock);
+ pagevec_deactivate_inactive(&pvec);
if (bio)
mpage_bio_submit(WRITE, bio);
return ret;
.
reply other threads:[~2002-08-11 7:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3D561496.66498087@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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).