linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Stoffel <stoffel@casc.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH] Reap dead swap cache earlier v2
Date: Thu, 7 Jun 2001 10:47:11 -0400	[thread overview]
Message-ID: <15135.37871.373389.465893@gargle.gargle.HOWL> (raw)
In-Reply-To: <Pine.LNX.4.21.0106061705250.3769-100000@freak.distro.conectiva>

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
	 stoffel@lucent.com - http://www.lucent.com - 978-952-7548
--
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/

  reply	other threads:[~2001-06-07 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-06 20:07 Marcelo Tosatti
2001-06-07 14:47 ` John Stoffel [this message]
2001-06-07 15:44   ` Hugh Dickins
2001-06-07 19:07 ` Jonathan Morton
2001-06-07 17:38   ` Marcelo Tosatti
2001-06-07 19:31     ` Jonathan Morton

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=15135.37871.373389.465893@gargle.gargle.HOWL \
    --to=stoffel@casc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo@conectiva.com.br \
    --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