From: Rik van Riel <riel@conectiva.com.br>
To: Roel van der Goot <roel@cs.ualberta.ca>
Cc: linux-mm@kvack.org, linux-kernel@vger.rutgers.edu
Subject: Re: [PATCH] pre7-1 semicolon & nicely readableB
Date: Mon, 1 May 2000 22:28:51 -0300 (BRST) [thread overview]
Message-ID: <Pine.LNX.4.21.0005012222540.7508-100000@duckman.conectiva> (raw)
In-Reply-To: <Pine.SOL.3.96.1000501190034.4093K-100000@sexsmith.cs.ualberta.ca>
On Mon, 1 May 2000, Roel van der Goot wrote:
> I want to inform you that there is a subtle difference between
> the following two loops:
>
> (i)
>
> while ((mm->swap_cnt << 2 * (i + 1) < max_cnt)
> && i++ < 10);
>
> (ii)
>
> while ((mm->swap_cnt << 2 * (i + 1) < max_cnt)
> && i < 10)
> i++;
I want to inform you that you're wrong. The only difference is
in readability.
If the first test fails, the clause behind the && won't be run.
Furthermore, i will only reach 10 if the RSS difference between
the current process and the biggest process is more than a factor
2^21 ... which can never happen on 32-bit hardware, unless the
RSS of the current process is 0.
In fact, the <10 test is only there to prevent infinite looping
for when a process with 0 swap_cnt "slips through" the tests above.
regards,
Rik
--
The Internet is not a network of computers. It is a network
of people. That is its real strength.
Wanna talk about the kernel? irc.openprojects.net / #kernelnewbies
http://www.conectiva.com/ http://www.surriel.com/
--
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 prev parent reply other threads:[~2000-05-02 1:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-02 1:08 Roel van der Goot
2000-05-02 1:28 ` Rik van Riel [this message]
2000-05-02 1:38 ` [PATCH] pre7-1 semicolon & nicely readable Roel van der Goot
2000-05-02 10:54 ` [PATCH] pre7-1 semicolon & nicely readableB Chris Evans
2000-05-02 11:19 ` Rik van Riel
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.21.0005012222540.7508-100000@duckman.conectiva \
--to=riel@conectiva.com.br \
--cc=linux-kernel@vger.rutgers.edu \
--cc=linux-mm@kvack.org \
--cc=riel@nl.linux.org \
--cc=roel@cs.ualberta.ca \
/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