mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linus Torvalds <torvalds@transmeta.com>, Andi Kleen <ak@suse.de>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: test13-pre5
Date: Sun, 31 Dec 2000 18:21:27 +0100	[thread overview]
Message-ID: <20001231182127.A24348@gruyere.muc.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.10.10012281459150.995-100000@penguin.transmeta.com> <Pine.LNX.4.10.10012301422310.581-100000@cassiopeia.home>
In-Reply-To: <Pine.LNX.4.10.10012301422310.581-100000@cassiopeia.home>; from geert@linux-m68k.org on Sat, Dec 30, 2000 at 02:24:06PM +0100

On Sat, Dec 30, 2000 at 02:24:06PM +0100, Geert Uytterhoeven wrote:
> On Thu, 28 Dec 2000, Linus Torvalds wrote:
> > On Thu, 28 Dec 2000, Andi Kleen wrote:
> > > - Instead of having a zone pointer mask use a 8 or 16 byte index into a 
> > > zone table. On a modern CPU it is much cheaper to do the and/shifts than
> > > to do even a single cache miss during page aging. On a lot of systems 
> > > that zone index could be hardcoded to 0 anyways, giving better code.
> > > - Instead of using 4/8 bytes for the age use only 16bit (FreeBSD which
> > > has the same swapping algorithm even only uses 8bit) 
> > 
> > This would be good, but can be hard.
> > 
> > FreeBSD doesn't try to be portable any more, but Linux does, and there are
> > architectures where 8- and 16-bit accesses aren't atomic but have to be
> > done with read-modify-write cycles.
> > 
> > And even for fields like "age", where we don't care whether the age itself
> > is 100% accurate, we _do_ care that the fields close-by don't get strange
> > effects from updating "age". We used to have exactly this problem on alpha
> > back in the 2.1.x timeframe.
> > 
> > This is why a lot of fields are 32-bit, even though we wouldn't need more
> > than 8 or 16 bits of them.
> 
> What about defining new types for this? Like e.g. `x8', being `u8' on platforms
> were that's OK, and `u32' on platforms where that's more efficient?

Sounds good. It could also be controlled by a CONFIG_SPACE_EFFICIENT for
embedded systems, where you could trade a bit of CPU for less memory overhead 
even on systems where u8 is slow and atomicity doesn't come into play
because it's UP anyways. 

Only problem I see is that when the programmer was wrong about the possible
range (which sometimes happens) then it could mysteriously work on some
machines and fail on others. This is already the case e.g. with atomic_t,
which is shorter than 32bit e.g. on sparc32, so it is probably not a too
big problem. 


-Andi

/* asm/types.h for a random 32bit machine with no byte access */ 
#if defined(CONFIG_SPACE_EFFICIENT) && !defined(CONFIG_SMP)
typedef __u8 x8; 
typedef __u16 x16; 
typedef __u32 x32; 
#else
typedef __u32 x8; 
typedef __u32 x16; 
typedef __u32 x32; 
#endif

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-31 17:52 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-28 20:25 test13-pre5 Linus Torvalds
2000-12-28 18:39 ` test13-pre5 Marcelo Tosatti
2000-12-28 20:59   ` test13-pre5 Linus Torvalds
2000-12-28 19:22     ` test13-pre5 Marcelo Tosatti
2000-12-28 21:21       ` [wildly off-topic] test13-pre5 Rik van Riel
2000-12-28 19:31         ` Marcelo Tosatti
2000-12-28 21:39     ` test13-pre5 Daniel Phillips
2000-12-28 22:14     ` test13-pre5 Marcelo Tosatti
2000-12-29  1:10       ` test13-pre5 Linus Torvalds
2000-12-29 12:06       ` test13-pre5 Daniel Phillips
2000-12-28 22:17     ` test13-pre5 Andi Kleen
2000-12-28 23:15       ` test13-pre5 Linus Torvalds
2000-12-28 23:25         ` test13-pre5 Andi Kleen
2000-12-28 23:37           ` test13-pre5 Linus Torvalds
2000-12-28 23:43             ` test13-pre5 Andi Kleen
2000-12-29  0:49             ` test13-pre5 Stefan Traby
2000-12-29  1:23               ` test13-pre5 Linus Torvalds
2000-12-29  1:06                 ` test13-pre5 Albert Cranford
2000-12-29 14:53                   ` test13-pre5 Stefan Traby
2000-12-30 13:24         ` test13-pre5 Geert Uytterhoeven
2000-12-31 17:21           ` Andi Kleen [this message]
2000-12-31 17:27             ` test13-pre5 Linus Torvalds
2000-12-31 17:36               ` test13-pre5 Andi Kleen
2000-12-31 18:19                 ` test13-pre5 Andrea Arcangeli
2000-12-31 18:06               ` test13-pre5 Andi Kleen
2000-12-31 18:07               ` test13-pre5 Matti Aarnio
2000-12-31 19:15                 ` test13-pre5 Linus Torvalds
2000-12-31 19:49                   ` test13-pre5 Andi Kleen
2000-12-31 18:10               ` test13-pre5 Andrea Arcangeli
2001-01-01 19:58           ` test13-pre5 H. Peter Anvin
2000-12-28 22:33     ` test13-pre5 David S. Miller
2000-12-28 22:54       ` test13-pre5 David S. Miller
2000-12-28 23:14         ` test13-pre5 David S. Miller
2000-12-28 23:39           ` test13-pre5 Andi Kleen
2000-12-28 23:17         ` test13-pre5 Andi Kleen
2000-12-28 23:25           ` test13-pre5 Rik van Riel
2000-12-28 23:36           ` test13-pre5 Linus Torvalds
2000-12-28 22:58       ` test13-pre5 Andi Kleen
2000-12-28 23:03         ` test13-pre5 Rik van Riel
2000-12-29 15:46       ` test13-pre5 Mark Hemment
2000-12-29 16:30         ` test13-pre5 Tim Wright
2000-12-29 17:54           ` test13-pre5 Mark Hemment
2000-12-29 21:23         ` test13-pre5 David S. Miller
2000-12-29 21:51           ` test13-pre5 Linus Torvalds
2000-12-29 16:49     ` [PATCH] filemap_fdatasync & related changes Marcelo Tosatti
2000-12-29 21:13       ` Linus Torvalds
2001-01-03 16:37       ` Chris Mason
2001-01-03 17:07         ` Daniel Phillips
2001-01-03 18:28         ` Linus Torvalds
2001-01-03 19:09           ` Chris Mason
2001-01-03 21:39             ` Chris Wedgwood
2001-01-04 18:46           ` Stephen C. Tweedie
2001-01-04  9:48         ` Christoph Rohland
2001-01-04 14:41           ` Marcelo Tosatti
2001-01-04 16:58             ` Rik van Riel
2001-01-04 17:38               ` Chris Mason
2001-01-04 18:00                 ` Linus Torvalds
2001-01-04 22:52                   ` Daniel Phillips
2001-01-04 15:30           ` Chris Mason
2001-01-04 17:01             ` Christoph Rohland
2000-12-28 21:27 ` test13-pre5 (via82cxxx_audio.c) Jonathan Hudson
2000-12-29 18:17 ` test13-pre5 Tom Rini

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=20001231182127.A24348@gruyere.muc.suse.de \
    --to=ak@suse.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®