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 18:37:31 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0611291822420.3513@woody.osdl.org> (raw)
In-Reply-To: <456E3E98.5010706@yahoo.com.au>


On Thu, 30 Nov 2006, Nick Piggin wrote:
>
> > In contrast, a "pdt_t" can be "unsigned long" or an anonymous struct, or
> > anything else. A "u64" can be "unsigned long long" or "unsigned long"
> > depending on architecture, etc. But a "struct kmem_cache" is always a
> > "struct kmem_cache". 
> 
> Oh yeah, I was thinking you could put it in a struct anyway, but I get
> your point about struct passing performance (even if it doesn't happen
> much in the vm code).

These days, we probably could always make "pdt_t" and friends always be 
structures. That particular typedef harks back to an older age, when gcc 
generated much worse code for structures than for "unsigned long" (it 
still does for explicit calls, but for inline functions it _mostly_ 
generates identical code).

So iirc, there was literally a "type safety" config option that turned on 
the structure version (because that one caught misuses with compiler 
typechecking and nasty warnings), and then the totally standard "unsigned 
long" thing (which generated better code).

I don't remember when we got rid of the "structure or unsigned long" 
option, it must have been a long time ago. But it explains why that 
particular thing is a typedef (and by now, I'd hate to untypedef it, 
since the whole "pgt_t pgd" thing has become something of a pattern in 
the VM layer, so it would irritate me mightily to change an existing 
mental pattern that's been around for a decade or more by now).

And it really still is "unsigned long" on some architectures, and I have 
this dim memory of it being because struct passing was really horrid on 
some architecture (like HP-PA that had lots of out-of-line calls because 
of the page table functions needing a lot of massaging? I forget).

[ Oh, actually - looking at <asm-parisc/page.h>, I see that they still 
  have the "STRICT_MM_TYPECHECKS" config option. That's what it was called 
  on i386 too, and it seems the remnants are still around on various 
  architecures. Although it can't have been parisc that had code 
  generation trouble, because that one selects the strict typechecks by 
  default.. Maybe ARM? ]

> I guess I'm not arguing to use the typedef so much as I wanted to know why
> it is being removed (ie. why now). Do you think that avoiding the slab.h
> include when some code just needs a struct kmem_cache * is a good policy?

I don't generally think it's a huge deal, but on general principles I do 
tend to prefer not seeing typedef's unless there's a reason for it, which 
is why I'd support this kind of patch.

This particular one doesn't disturb me the way some have done. I literally 
asked for the "task_t" typedef to be removed (ugh, that one _really_ 
irritated me, especially since code mixed the two, and "struct 
task_struct" was the traditional and long-standing way to do it).

On the other hand, if it actually causes pain (eg merge issues etc), it's 
definitely not important enough to do. 

			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-30  2:37 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
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 [this message]
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.0611291822420.3513@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