Re: [PATCH] Reap dead swap cache earlier v2
>> >As suggested by Linus, I've cleaned the reapswap code to be contained >> >inside an inline function. (yes, the if statement is really ugly) >> >> I can't seem to find the patch which adds this behaviour to the background >> scanning. > >I've just sent Linus a patch to free swap cache pages at the time we free >the last pte. (requested by himself) > >With it applied we should get the old behaviour back again. > >I can put it on my webpage if you wish. Just copy it to me so I can replace the dead-swap hacks you introduced earlier. -- from: Jonathan "Chromatix" Morton mail: [EMAIL PROTECTED] (not for attachments) The key to knowledge is not to rely on people to teach you it. GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
On Thu, 7 Jun 2001, Jonathan Morton wrote: > >As suggested by Linus, I've cleaned the reapswap code to be contained > >inside an inline function. (yes, the if statement is really ugly) > > I can't seem to find the patch which adds this behaviour to the background > scanning. I've just sent Linus a patch to free swap cache pages at the time we free the last pte. (requested by himself) With it applied we should get the old behaviour back again. I can put it on my webpage if you wish. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
>As suggested by Linus, I've cleaned the reapswap code to be contained >inside an inline function. (yes, the if statement is really ugly) I can't seem to find the patch which adds this behaviour to the background scanning. Can someone point me to it? -- from: Jonathan "Chromatix" Morton mail: [EMAIL PROTECTED] (not for attachments) The key to knowledge is not to rely on people to teach you it. GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
On Thu, 7 Jun 2001, John Stoffel wrote: > Shouldn't the "swap_count(page) == 1" check be earlier in the if > statement, so we can fall through more quickly if there is no work to > be done? A small optimization, but putting the common cases first > will help. I don't think so: the out-of-line swap_count() function is considerably more complicated than the macros and inline functions tested before it. Hugh - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
Marcelo> As suggested by Linus, I've cleaned the reapswap code to be Marcelo> contained inside an inline function. (yes, the if statement Marcelo> is really ugly) Shouldn't the "swap_count(page) == 1" check be earlier in the if statement, so we can fall through more quickly if there is no work to be done? A small optimization, but putting the common cases first will help. Marcelo> +static inline int clean_dead_swap_page (struct page* page) Marcelo> +{ Marcelo> + int ret = 0; Marcelo> + if (!TryLockPage (page)) { Marcelo> + if (PageSwapCache(page) && PageDirty(page) && Marcelo> + (page_count(page) - !!page->buffers) == 1 && Marcelo> + swap_count(page) == 1) { Marcelo> + ClearPageDirty(page); Marcelo> + ClearPageReferenced(page); Marcelo> + page->age = 0; Marcelo> + ret = 1; Marcelo> + } Thanks, John John Stoffel - Senior Unix Systems Administrator - Lucent Technologies [EMAIL PROTECTED] - http://www.lucent.com - 978-952-7548 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
Marcelo As suggested by Linus, I've cleaned the reapswap code to be Marcelo contained inside an inline function. (yes, the if statement Marcelo is really ugly) Shouldn't the swap_count(page) == 1 check be earlier in the if statement, so we can fall through more quickly if there is no work to be done? A small optimization, but putting the common cases first will help. Marcelo +static inline int clean_dead_swap_page (struct page* page) Marcelo +{ Marcelo + int ret = 0; Marcelo + if (!TryLockPage (page)) { Marcelo + if (PageSwapCache(page) PageDirty(page) Marcelo + (page_count(page) - !!page-buffers) == 1 Marcelo + swap_count(page) == 1) { Marcelo + ClearPageDirty(page); Marcelo + ClearPageReferenced(page); Marcelo + page-age = 0; Marcelo + ret = 1; Marcelo + } Thanks, John John Stoffel - Senior Unix Systems Administrator - Lucent Technologies [EMAIL PROTECTED] - http://www.lucent.com - 978-952-7548 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
On Thu, 7 Jun 2001, John Stoffel wrote: Shouldn't the swap_count(page) == 1 check be earlier in the if statement, so we can fall through more quickly if there is no work to be done? A small optimization, but putting the common cases first will help. I don't think so: the out-of-line swap_count() function is considerably more complicated than the macros and inline functions tested before it. Hugh - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
As suggested by Linus, I've cleaned the reapswap code to be contained inside an inline function. (yes, the if statement is really ugly) I can't seem to find the patch which adds this behaviour to the background scanning. Can someone point me to it? -- from: Jonathan Chromatix Morton mail: [EMAIL PROTECTED] (not for attachments) The key to knowledge is not to rely on people to teach you it. GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
On Thu, 7 Jun 2001, Jonathan Morton wrote: As suggested by Linus, I've cleaned the reapswap code to be contained inside an inline function. (yes, the if statement is really ugly) I can't seem to find the patch which adds this behaviour to the background scanning. I've just sent Linus a patch to free swap cache pages at the time we free the last pte. (requested by himself) With it applied we should get the old behaviour back again. I can put it on my webpage if you wish. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Reap dead swap cache earlier v2
As suggested by Linus, I've cleaned the reapswap code to be contained inside an inline function. (yes, the if statement is really ugly) I can't seem to find the patch which adds this behaviour to the background scanning. I've just sent Linus a patch to free swap cache pages at the time we free the last pte. (requested by himself) With it applied we should get the old behaviour back again. I can put it on my webpage if you wish. Just copy it to me so I can replace the dead-swap hacks you introduced earlier. -- from: Jonathan Chromatix Morton mail: [EMAIL PROTECTED] (not for attachments) The key to knowledge is not to rely on people to teach you it. GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Reap dead swap cache earlier v2
Hi, As suggested by Linus, I've cleaned the reapswap code to be contained inside an inline function. (yes, the if statement is really ugly) Tested and against 2.4.6pre1. --- linux.orig/mm/vmscan.c Wed Jun 6 18:16:45 2001 +++ linux/mm/vmscan.c Wed Jun 6 18:28:26 2001 @@ -407,6 +407,27 @@ memory_pressure++; return page; } +/* + * Check for dead swap cache pages and clean them, forcing + * those pages to be freed earlier. + */ +static inline int clean_dead_swap_page (struct page* page) +{ + int ret = 0; + if (!TryLockPage (page)) { + if (PageSwapCache(page) && PageDirty(page) && + (page_count(page) - !!page->buffers) == 1 && + swap_count(page) == 1) { + ClearPageDirty(page); + ClearPageReferenced(page); + page->age = 0; + ret = 1; + } + UnlockPage(page); + } + return ret; +} + /** * page_launder - clean dirty inactive pages, move to inactive_clean list @@ -456,6 +477,12 @@ continue; } + /* +* Check for dead swap cache pages +* before doing any other checks. +*/ + clean_dead_swap_page(page); + /* Page is or was in use? Move it to the active list. */ if (PageReferenced(page) || page->age > 0 || page->zone->free_pages > page->zone->pages_high || @@ -666,6 +693,15 @@ printk("VM: refill_inactive, wrong page on list.\n"); list_del(page_lru); nr_active_pages--; + continue; + } + + /* +* Special case for dead swap cache pages. +*/ + if (clean_dead_swap_page(page)) { + deactivate_page_nolock(page); + nr_deactivated++; continue; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Reap dead swap cache earlier v2
Hi, As suggested by Linus, I've cleaned the reapswap code to be contained inside an inline function. (yes, the if statement is really ugly) Tested and against 2.4.6pre1. --- linux.orig/mm/vmscan.c Wed Jun 6 18:16:45 2001 +++ linux/mm/vmscan.c Wed Jun 6 18:28:26 2001 @@ -407,6 +407,27 @@ memory_pressure++; return page; } +/* + * Check for dead swap cache pages and clean them, forcing + * those pages to be freed earlier. + */ +static inline int clean_dead_swap_page (struct page* page) +{ + int ret = 0; + if (!TryLockPage (page)) { + if (PageSwapCache(page) PageDirty(page) + (page_count(page) - !!page-buffers) == 1 + swap_count(page) == 1) { + ClearPageDirty(page); + ClearPageReferenced(page); + page-age = 0; + ret = 1; + } + UnlockPage(page); + } + return ret; +} + /** * page_launder - clean dirty inactive pages, move to inactive_clean list @@ -456,6 +477,12 @@ continue; } + /* +* Check for dead swap cache pages +* before doing any other checks. +*/ + clean_dead_swap_page(page); + /* Page is or was in use? Move it to the active list. */ if (PageReferenced(page) || page-age 0 || page-zone-free_pages page-zone-pages_high || @@ -666,6 +693,15 @@ printk(VM: refill_inactive, wrong page on list.\n); list_del(page_lru); nr_active_pages--; + continue; + } + + /* +* Special case for dead swap cache pages. +*/ + if (clean_dead_swap_page(page)) { + deactivate_page_nolock(page); + nr_deactivated++; continue; } - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/