linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	Christoph Lameter <clameter@sgi.com>,
	linux-mm@kvack.org
Subject: Re: Slab: Remove kmem_cache_t
Date: Wed, 29 Nov 2006 07:48:34 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0611290738270.3395@woody.osdl.org> (raw)
In-Reply-To: <456D1FDA.4040201@yahoo.com.au>


On Wed, 29 Nov 2006, Nick Piggin wrote:
> 
> I don't see why pagetable types are conceptually different from slab here.

Because they are fundamentally _different_ on different architectures.

If they were always the same, they wouldn't be typedefs.

> pagetable types can all have the same struct name. Should we do a script
> to change them?

Theyt aren't even necessarily structs. They're quite often "unsigned 
long".

In fact, they were that on x86 for the longest time (and making them into 
a struct was a conscious thing to make sure that you couldn't use them as 
integers even by mistake).

> > 	"kmem_cache_t" is strictly _worse_ than "struct kmem_cache", not
> > just because it causes declaration issues. It also hides the fact 	that
> > the thing really is a structure (and hiding the fact that 	it's a pointer
> > is a shooting offense: things like "voidptr_t" 	should not be allowed
> > at all)
> 
> Umm, but it's not a pointer, is it?

No, I'm saying that some people hide the pointer-ness inside the typedef 
too, and that should be a shooting offence.

> I think slab.c should use struct kmem_cache, but I don't see why this script
> needs to change over all callers. At least, not in the name of solving
> dependency issues?!?

The dependency issues can come up because of a problem with typedefs.

It's strictly an error to declare the same typedef twice in the same 
scope. So if you want to have robust header files, you can do that only in 
a _single_ place. Which in turn means that you always have a dependency on 
that magic header in anything that needs it.

On the other hand, you can always pre-declare an opaque structure however 
many times you want, so there is no similar problem at all with "struct 
kmem_cache". You can just sprinkle that one-liner "I know there is such a 
thing, although I don't know what it contains" in multiple places, and 
break the dependency.

So "typedef" is strictly _inconvenient_ too, if you want to have split 
header files.

		Linus

--
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:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2006-11-29 15:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29  2:49 Christoph Lameter
2006-11-29  3:06 ` Andrew Morton
2006-11-29  4:06 ` Nick Piggin
2006-11-29  3:32   ` Christoph Lameter
2006-11-29  4:42     ` Nick Piggin
2006-11-29  3:48       ` Nick Piggin
2006-11-29  4:06       ` Andrew Morton
2006-11-29  4:38         ` Linus Torvalds
2006-11-29  5:51           ` Nick Piggin
2006-11-29 15:48             ` Linus Torvalds [this message]
2006-11-30  1:40               ` Nick Piggin
2006-11-30  1:59                 ` Linus Torvalds
2006-11-30  2:14                   ` Nick Piggin
2006-11-30  2:37                     ` Linus Torvalds
2006-11-30  2:51                       ` Nick Piggin
2006-11-29  6:21           ` Nick Piggin
2006-11-29 16:11             ` Linus Torvalds
2006-11-29  5:41         ` Nick Piggin
2006-11-29  6:24           ` Andrew Morton
2006-11-29  6:41             ` Nick Piggin
2006-11-29  7:08               ` Andrew Morton
2006-11-29  7:23                 ` Nick Piggin
2006-11-29  7:41                   ` Andrew Morton
2006-11-29  8:04                     ` Nick Piggin
2006-11-29 16:23                       ` Linus Torvalds
2006-11-30  1:44                         ` Nick Piggin
2006-11-29 19:16               ` Christoph Lameter
2006-11-29  8:50 ` Peter Zijlstra
2006-11-29 19:27   ` Christoph Lameter

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.64.0611290738270.3395@woody.osdl.org \
    --to=torvalds@osdl.org \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    /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