From: Hugh Dickins <hugh@veritas.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-mm@kvack.org
Subject: Re: [PATCH] small valid_swaphandles() optimization
Date: Thu, 26 May 2005 03:15:16 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.61.0505260303520.5870@goblin.wat.veritas.com> (raw)
In-Reply-To: <20050525134234.GA16054@logos.cnet>
On Wed, 25 May 2005, Marcelo Tosatti wrote:
>
> The following patch, relative to valid_swaphandles(), moves the EOF
> check outside validity check loop, saving a few instructions.
But increasing the function's footprint - though not very excitingly
either way. Any benchmarks in support of it ?-)
Hmmm. Doesn't it go wrong on the toff == swapdev->max - 1 case,
when i becomes 0 then is decremented negative at the end of the loop?
Easily fixed, but suggests your optimization not worth the obfuscation?
Hugh
> --- a/mm/swapfile.c.orig 2005-05-25 15:45:18.000000000 -0300
> +++ b/mm/swapfile.c 2005-05-25 16:20:45.000000000 -0300
> @@ -1713,11 +1713,12 @@
> toff++, i--;
> *offset = toff;
>
> + /* Don't read-ahead past the end of the swap area */
> + if (toff+i >= swapdev->max)
> + i = swapdev->max - toff - 1;
> +
> swap_device_lock(swapdev);
> do {
> - /* Don't read-ahead past the end of the swap area */
> - if (toff >= swapdev->max)
> - break;
> /* Don't read in free or bad pages */
> if (!swapdev->swap_map[toff])
> 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:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2005-05-26 2:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-25 13:42 Marcelo Tosatti
2005-05-26 2:15 ` Hugh Dickins [this message]
2005-05-26 7:05 ` Marcelo Tosatti
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=Pine.LNX.4.61.0505260303520.5870@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=akpm@osdl.org \
--cc=linux-mm@kvack.org \
--cc=marcelo.tosatti@cyclades.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