From: Zlatko Calusic <zlatko@iskon.hr>
To: linux-mm@kvack.org
Subject: [patch] mm-deactivate-fix-1
Date: 14 Jan 2001 14:40:55 +0100 [thread overview]
Message-ID: <87ofxaz1y0.fsf@atlas.iskon.hr> (raw)
I have noticed that in deactivate_page_nolock() function pages get
unconditionally moved from the active to the inact_dirty list. Even if
it is really easy with additional check to put them straight to the
inact_clean list if they're freeable. That keeps the list statistics
more accurate and in the end should result in a little bit less CPU
cycles burned (only one list transition, less locking). As a bonus,
the comment above the function is now correct. :)
I have tested the patch thoroughly and couldn't find any problems with
it. It should be really safe as reclaim_page() already carefully
checks pages before freeing.
Comments?
Index: 0.19/mm/swap.c
--- 0.19/mm/swap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/17_swap.c 1.1 644)
+++ 0.19(w)/mm/swap.c Sun, 14 Jan 2001 14:05:49 +0100 zcalusic (linux24/j/17_swap.c 1.1 644)
@@ -172,7 +172,6 @@
* Besides, as long as we don't move unfreeable pages to the
* inactive_clean list it doesn't need to be perfect...
*/
- int maxcount = (page->buffers ? 3 : 2);
page->age = 0;
ClearPageReferenced(page);
@@ -180,11 +179,19 @@
* Don't touch it if it's not on the active list.
* (some pages aren't on any list at all)
*/
- if (PageActive(page) && page_count(page) <= maxcount && !page_ramdisk(page)) {
- del_page_from_active_list(page);
+ if (!PageActive(page)
+ || page_count(page) > (page->buffers ? 3 : 2)
+ || page_ramdisk(page))
+ return;
+
+ del_page_from_active_list(page);
+
+ if (page->mapping && !page->buffers && !PageDirty(page)) {
+ add_page_to_inactive_clean_list(page);
+ } else {
add_page_to_inactive_dirty_list(page);
}
-}
+}
void deactivate_page(struct page * page)
{
--
Zlatko
--
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.eu.org/Linux-MM/
next reply other threads:[~2001-01-14 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-14 13:40 Zlatko Calusic [this message]
2001-01-14 12:57 ` Marcelo Tosatti
2001-01-14 15:48 ` Zlatko Calusic
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=87ofxaz1y0.fsf@atlas.iskon.hr \
--to=zlatko@iskon.hr \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox